mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[iso] initial ISO image support (EXPERIMENTAL)
* from libcdio: http://www.gnu.org/software/libcdio/
This commit is contained in:
		
							parent
							
								
									9d2f9faa70
								
							
						
					
					
						commit
						5bd86bc743
					
				
					 93 changed files with 18908 additions and 676 deletions
				
			
		
							
								
								
									
										13
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -3463,6 +3463,10 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h | |||
| #	AC_MSG_ERROR([unsupported development environment]) | ||||
| #esac | ||||
| 
 | ||||
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling Large File Support (for ISO images)" >&5 | ||||
| $as_echo "enabling Large File Support (for ISO images)" >&6; } | ||||
| AM_CFLAGS="-D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t" | ||||
| 
 | ||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | ||||
| # in msapi_utf8.h - including winver.h only doesn't work | ||||
| AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" | ||||
|  | @ -3550,6 +3554,12 @@ ac_config_files="$ac_config_files src/syslinux/libfat/Makefile" | |||
| 
 | ||||
| ac_config_files="$ac_config_files src/syslinux/libinstaller/Makefile" | ||||
| 
 | ||||
| ac_config_files="$ac_config_files src/libcdio/iso9660/Makefile" | ||||
| 
 | ||||
| ac_config_files="$ac_config_files src/libcdio/udf/Makefile" | ||||
| 
 | ||||
| ac_config_files="$ac_config_files src/libcdio/driver/Makefile" | ||||
| 
 | ||||
| cat >confcache <<\_ACEOF | ||||
| # This file is a shell script that caches the results of configure | ||||
| # tests run on this system so they can be shared between configure | ||||
|  | @ -4284,6 +4294,9 @@ do | |||
|     "src/ms-sys/Makefile") CONFIG_FILES="$CONFIG_FILES src/ms-sys/Makefile" ;; | ||||
|     "src/syslinux/libfat/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libfat/Makefile" ;; | ||||
|     "src/syslinux/libinstaller/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libinstaller/Makefile" ;; | ||||
|     "src/libcdio/iso9660/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/iso9660/Makefile" ;; | ||||
|     "src/libcdio/udf/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/udf/Makefile" ;; | ||||
|     "src/libcdio/driver/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/driver/Makefile" ;; | ||||
| 
 | ||||
|   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; | ||||
|   esac | ||||
|  |  | |||
|  | @ -32,6 +32,9 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) | |||
| #	AC_MSG_ERROR([unsupported development environment]) | ||||
| #esac | ||||
| 
 | ||||
| AC_MSG_RESULT([enabling Large File Support (for ISO images)]) | ||||
| AM_CFLAGS="-D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t" | ||||
| 
 | ||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | ||||
| # in msapi_utf8.h - including winver.h only doesn't work | ||||
| AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" | ||||
|  | @ -89,4 +92,7 @@ AC_CONFIG_FILES([src/Makefile]) | |||
| AC_CONFIG_FILES([src/ms-sys/Makefile]) | ||||
| AC_CONFIG_FILES([src/syslinux/libfat/Makefile]) | ||||
| AC_CONFIG_FILES([src/syslinux/libinstaller/Makefile]) | ||||
| AC_CONFIG_FILES([src/libcdio/iso9660/Makefile]) | ||||
| AC_CONFIG_FILES([src/libcdio/udf/Makefile]) | ||||
| AC_CONFIG_FILES([src/libcdio/driver/Makefile]) | ||||
| AC_OUTPUT | ||||
|  |  | |||
|  | @ -1,59 +0,0 @@ | |||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 11.00 | ||||
| # Visual Studio 2010 | ||||
| Project("{11411DA5-63FE-49DC-8D5C-CA379B95FF3C}") = "rufus", "src\.msvc\rufus_2010.vcxproj", "{731858A7-0303-4988-877B-9C0DD6471864}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6} = {2B1D078D-8EB4-4398-9CA4-23457265A7F6} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{11411DA5-63FE-49DC-8D5C-CA379B95FF3C}") = "ms-sys", "src\ms-sys\.msvc\ms-sys.vcxproj", "{2B1D078D-8EB4-4398-9CA4-23457265A7F6}" | ||||
| EndProject | ||||
| Project("{11411DA5-63FE-49DC-8D5C-CA379B95FF3C}") = "syslinux-libfat", "src\syslinux\libfat\.msvc\libfat.vcxproj", "{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}" | ||||
| EndProject | ||||
| Project("{11411DA5-63FE-49DC-8D5C-CA379B95FF3C}") = "syslinux-libinstaller", "src\syslinux\libinstaller\.msvc\libinstaller.vcxproj", "{266502AC-CD74-4581-B707-938A7D05AD7A}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Win32 = Debug|Win32 | ||||
| 		Debug|x64 = Debug|x64 | ||||
| 		Release|Win32 = Release|Win32 | ||||
| 		Release|x64 = Release|x64 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{731858A7-0303-4988-877B-9C0DD6471864}.Release|x64.Build.0 = Release|x64 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x64.Build.0 = Release|x64 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x64.Build.0 = Release|x64 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x64.Build.0 = Release|x64 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
|  | @ -77,10 +77,10 @@ | |||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <BuildLog /> | ||||
|     <ClCompile> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <AdditionalIncludeDirectories>..\ms-sys\inc;..\syslinux;..\syslinux\libinstaller;..\syslinux\libfat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <AdditionalIncludeDirectories>..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <AdditionalDependencies>setupapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|  | @ -99,8 +99,8 @@ | |||
|       <TargetEnvironment>X64</TargetEnvironment> | ||||
|     </Midl> | ||||
|     <ClCompile> | ||||
|       <AdditionalIncludeDirectories>..\ms-sys\inc;..\syslinux;..\syslinux\libinstaller;..\syslinux\libfat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|  | @ -119,10 +119,10 @@ | |||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <BuildLog /> | ||||
|     <ClCompile> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <AdditionalIncludeDirectories>..\ms-sys\inc;..\syslinux;..\syslinux\libinstaller;..\syslinux\libfat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <AdditionalIncludeDirectories>..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <AdditionalDependencies>setupapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|  | @ -141,10 +141,10 @@ | |||
|       <TargetEnvironment>X64</TargetEnvironment> | ||||
|     </Midl> | ||||
|     <ClCompile> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <AdditionalIncludeDirectories>..\ms-sys\inc;..\syslinux;..\syslinux\libinstaller;..\syslinux\libfat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <AdditionalIncludeDirectories>..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <AdditionalDependencies>setupapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|  | @ -163,6 +163,7 @@ | |||
|     <ClCompile Include="..\drive.c" /> | ||||
|     <ClCompile Include="..\format.c" /> | ||||
|     <ClCompile Include="..\dos.c" /> | ||||
|     <ClCompile Include="..\iso.c" /> | ||||
|     <ClCompile Include="..\rufus.c" /> | ||||
|     <ClCompile Include="..\stdio.c" /> | ||||
|     <ClCompile Include="..\stdlg.c" /> | ||||
|  | @ -172,6 +173,10 @@ | |||
|     <ClInclude Include="..\..\ms-config.h" /> | ||||
|     <ClInclude Include="..\badblocks.h" /> | ||||
|     <ClInclude Include="..\format.h" /> | ||||
|     <ClInclude Include="..\libcdio\cdio\cdio.h" /> | ||||
|     <ClInclude Include="..\libcdio\cdio\iso9660.h" /> | ||||
|     <ClInclude Include="..\libcdio\cdio\logging.h" /> | ||||
|     <ClInclude Include="..\libcdio\cdio\udf.h" /> | ||||
|     <ClInclude Include="..\msapi_utf8.h" /> | ||||
|     <ClInclude Include="..\dos.h" /> | ||||
|     <ClInclude Include="..\resource.h" /> | ||||
|  | @ -189,6 +194,15 @@ | |||
|     <ResourceCompile Include="..\rufus.rc" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\libcdio\driver\.msvc\driver.vcxproj"> | ||||
|       <Project>{fa1b1093-ba86-410a-b7a0-7a54c605f812}</Project> | ||||
|     </ProjectReference> | ||||
|     <ProjectReference Include="..\libcdio\iso9660\.msvc\iso9660.vcxproj"> | ||||
|       <Project>{d4e80f35-2604-40ac-b436-97b052ecb572}</Project> | ||||
|     </ProjectReference> | ||||
|     <ProjectReference Include="..\libcdio\udf\.msvc\udf.vcxproj"> | ||||
|       <Project>{0cec40a6-a195-4be5-a88b-0ab00eb142ec}</Project> | ||||
|     </ProjectReference> | ||||
|     <ProjectReference Include="..\ms-sys\.msvc\ms-sys.vcxproj"> | ||||
|       <Project>{2b1d078d-8eb4-4398-9ca4-23457265a7f6}</Project> | ||||
|     </ProjectReference> | ||||
|  |  | |||
|  | @ -42,6 +42,9 @@ | |||
|     <ClCompile Include="..\syslinux.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\iso.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\rufus.h"> | ||||
|  | @ -71,6 +74,18 @@ | |||
|     <ClInclude Include="..\..\ms-config.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\libcdio\cdio\cdio.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\libcdio\cdio\logging.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\libcdio\cdio\iso9660.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\libcdio\cdio\udf.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="..\..\res\rufus.ico"> | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ TARGETTYPE=PROGRAM | |||
| UMTYPE=windows | ||||
| UMENTRY=winmain | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.\ms-sys\inc;.\syslinux;.\syslinux\libfat;.\syslinux\libinstaller | ||||
| INCLUDES=$(DDK_INC_PATH);.\ms-sys\inc;.\syslinux\libfat;.\syslinux\libinstaller;.\msvc-missing;.\libcdio | ||||
| C_DEFINES = $(C_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
|  | @ -20,7 +20,10 @@ TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ | |||
|            $(SDK_LIB_PATH)\shell32.lib \ | ||||
|            .\ms-sys\ms-sys.lib \ | ||||
|            .\syslinux\libfat\libfat.lib \ | ||||
|            .\syslinux\libinstaller\libinstaller.lib | ||||
|            .\syslinux\libinstaller\libinstaller.lib \ | ||||
|            .\libcdio\iso9660\iso9660.lib \ | ||||
|            .\libcdio\udf\udf.lib \ | ||||
|            .\libcdio\driver\driver.lib | ||||
| 
 | ||||
| # http://jpassing.com/2008/02/01/how-to-use-manifests-with-buildexe/ | ||||
| SXS_APPLICATION_MANIFEST=..\common_controls_and_elevation.manifest | ||||
|  | @ -29,6 +32,7 @@ SOURCES=rufus.c          \ | |||
|         format.c         \ | ||||
|         stdio.c          \ | ||||
|         stdlg.c          \ | ||||
|         iso.c            \ | ||||
|         dos.c            \ | ||||
|         dos_locale.c     \ | ||||
|         badblocks.c      \ | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| SUBDIRS = ms-sys syslinux/libfat syslinux/libinstaller | ||||
| SUBDIRS = ms-sys syslinux/libfat syslinux/libinstaller libcdio/iso9660 libcdio/udf libcdio/driver | ||||
| 
 | ||||
| noinst_PROGRAMS = rufus | ||||
| 
 | ||||
|  | @ -9,7 +9,8 @@ pkg_v_rc_0 = @echo "  RC     $@"; | |||
| %_rc.o: %.rc | ||||
| 	$(pkg_v_rc)$(WINDRES) $(AM_RCFLAGS) -i $< -o $@ | ||||
| 
 | ||||
| rufus_SOURCES = drive.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c | ||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller $(AM_CFLAGS) | ||||
| rufus_SOURCES = drive.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c | ||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./libcdio $(AM_CFLAGS) | ||||
| rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | ||||
| rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a -lsetupapi -lole32 -lgdi32  | ||||
| rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \ | ||||
| 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32  | ||||
|  |  | |||
|  | @ -43,14 +43,16 @@ mkinstalldirs = $(install_sh) -d | |||
| CONFIG_CLEAN_FILES = | ||||
| CONFIG_CLEAN_VPATH_FILES = | ||||
| PROGRAMS = $(noinst_PROGRAMS) | ||||
| am_rufus_OBJECTS = rufus-drive.$(OBJEXT) rufus-dos.$(OBJEXT) \
 | ||||
| 	rufus-dos_locale.$(OBJEXT) rufus-badblocks.$(OBJEXT) \
 | ||||
| 	rufus-syslinux.$(OBJEXT) rufus-format.$(OBJEXT) \
 | ||||
| 	rufus-stdio.$(OBJEXT) rufus-stdlg.$(OBJEXT) \
 | ||||
| 	rufus-rufus.$(OBJEXT) | ||||
| am_rufus_OBJECTS = rufus-drive.$(OBJEXT) rufus-iso.$(OBJEXT) \
 | ||||
| 	rufus-dos.$(OBJEXT) rufus-dos_locale.$(OBJEXT) \
 | ||||
| 	rufus-badblocks.$(OBJEXT) rufus-syslinux.$(OBJEXT) \
 | ||||
| 	rufus-format.$(OBJEXT) rufus-stdio.$(OBJEXT) \
 | ||||
| 	rufus-stdlg.$(OBJEXT) rufus-rufus.$(OBJEXT) | ||||
| rufus_OBJECTS = $(am_rufus_OBJECTS) | ||||
| rufus_DEPENDENCIES = rufus_rc.o ms-sys/libmssys.a \
 | ||||
| 	syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a | ||||
| 	syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \
 | ||||
| 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a \
 | ||||
| 	libcdio/driver/libdriver.a | ||||
| rufus_LINK = $(CCLD) $(rufus_CFLAGS) $(CFLAGS) $(rufus_LDFLAGS) \
 | ||||
| 	$(LDFLAGS) -o $@ | ||||
| DEFAULT_INCLUDES = -I.@am__isrc@ | ||||
|  | @ -178,14 +180,16 @@ target_alias = @target_alias@ | |||
| top_build_prefix = @top_build_prefix@ | ||||
| top_builddir = @top_builddir@ | ||||
| top_srcdir = @top_srcdir@ | ||||
| SUBDIRS = ms-sys syslinux/libfat syslinux/libinstaller | ||||
| SUBDIRS = ms-sys syslinux/libfat syslinux/libinstaller libcdio/iso9660 libcdio/udf libcdio/driver | ||||
| pkg_v_rc = $(pkg_v_rc_$(V)) | ||||
| pkg_v_rc_ = $(pkg_v_rc_$(AM_DEFAULT_VERBOSITY)) | ||||
| pkg_v_rc_0 = @echo "  RC     $@"; | ||||
| rufus_SOURCES = drive.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c | ||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller $(AM_CFLAGS) | ||||
| rufus_SOURCES = drive.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c | ||||
| rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./libcdio $(AM_CFLAGS) | ||||
| rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows | ||||
| rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a -lsetupapi -lole32 -lgdi32  | ||||
| rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \
 | ||||
| 	libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32  | ||||
| 
 | ||||
| all: all-recursive | ||||
| 
 | ||||
| .SUFFIXES: | ||||
|  | @ -249,6 +253,14 @@ rufus-drive.obj: drive.c | |||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-drive.obj `if test -f 'drive.c'; then $(CYGPATH_W) 'drive.c'; else $(CYGPATH_W) '$(srcdir)/drive.c'; fi` | ||||
| 
 | ||||
| rufus-iso.o: iso.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-iso.o `test -f 'iso.c' || echo '$(srcdir)/'`iso.c | ||||
| 
 | ||||
| rufus-iso.obj: iso.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-iso.obj `if test -f 'iso.c'; then $(CYGPATH_W) 'iso.c'; else $(CYGPATH_W) '$(srcdir)/iso.c'; fi` | ||||
| 
 | ||||
| rufus-dos.o: dos.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-dos.o `test -f 'dos.c' || echo '$(srcdir)/'`dos.c | ||||
|  |  | |||
							
								
								
									
										265
									
								
								src/iso.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										265
									
								
								src/iso.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,265 @@ | |||
| /*
 | ||||
|  * Rufus: The Reliable USB Formatting Utility | ||||
|  * ISO file extraction | ||||
|  * Copyright (c) 2011-2012 Pete Batard <pete@akeo.ie> | ||||
|  * Based on libcdio's iso & udf samples: | ||||
|  * Copyright (c) 2003-2011 Rocky Bernstein <rocky@gnu.org> | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
|  */ | ||||
| 
 | ||||
| /* Memory leaks detection - define _CRTDBG_MAP_ALLOC as preprocessor macro */ | ||||
| #ifdef _CRTDBG_MAP_ALLOC | ||||
| #include <stdlib.h> | ||||
| #include <crtdbg.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <windows.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
| #include <malloc.h> | ||||
| #include <errno.h> | ||||
| #include <direct.h> | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/logging.h> | ||||
| #include <cdio/iso9660.h> | ||||
| #include <cdio/udf.h> | ||||
| 
 | ||||
| #include "rufus.h" | ||||
| 
 | ||||
| #ifndef MIN | ||||
| #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||||
| #endif | ||||
| 
 | ||||
| #define print_vd_info(title, fn)      \ | ||||
|   if (fn(p_iso, &psz_str)) {          \ | ||||
|     uprintf(title ": %s\n", psz_str); \ | ||||
|   }                                   \ | ||||
|   free(psz_str);                      \ | ||||
|   psz_str = NULL; | ||||
| 
 | ||||
| /* Needed for UDF ISO access */ | ||||
| // TODO: should be able to elmininate those with an alternate approach
 | ||||
| CdIo_t* cdio_open (const char *psz_source, driver_id_t driver_id) {return NULL;} | ||||
| void cdio_destroy (CdIo_t *p_cdio) {} | ||||
| 
 | ||||
| const char *psz_extract_dir = "D:/tmp/iso"; | ||||
| 
 | ||||
| // TODO: Unicode support, progress computation, timestamp preservation
 | ||||
| 
 | ||||
| static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const char *psz_path) | ||||
| { | ||||
| 	FILE *fd = NULL; | ||||
| 	int i_length; | ||||
| 	char* psz_fullpath; | ||||
| 	const char* psz_basename; | ||||
| 	udf_dirent_t *p_udf_dirent2; | ||||
| 	uint8_t buf[UDF_BLOCKSIZE]; | ||||
| 	int64_t i_read, i_file_length; | ||||
| 
 | ||||
| 	if ((p_udf_dirent == NULL) || (psz_path == NULL)) | ||||
| 		return 1; | ||||
| 
 | ||||
| 	while (udf_readdir(p_udf_dirent)) { | ||||
| 		psz_basename = udf_get_filename(p_udf_dirent); | ||||
| 		i_length = (int)(3 + strlen(psz_path) + strlen(psz_basename) + strlen(psz_extract_dir)); | ||||
| 		psz_fullpath = (char*)calloc(sizeof(char), i_length); | ||||
| 		if (psz_fullpath == NULL) { | ||||
| 			uprintf("Error allocating file name\n"); | ||||
| 			goto out; | ||||
| 		} | ||||
| 		i_length = _snprintf(psz_fullpath, i_length, "%s%s/%s", psz_extract_dir, psz_path, psz_basename); | ||||
| 		if (i_length < 0) { | ||||
| 			goto out; | ||||
| 		} | ||||
| 		uprintf("Extracting: %s\n", psz_fullpath); | ||||
| 		if (udf_is_dir(p_udf_dirent)) { | ||||
| 			_mkdir(psz_fullpath); | ||||
| 			p_udf_dirent2 = udf_opendir(p_udf_dirent); | ||||
| 			if (p_udf_dirent2 != NULL) { | ||||
| 				if (udf_extract_files(p_udf, p_udf_dirent2, &psz_fullpath[strlen(psz_extract_dir)])) | ||||
| 					goto out; | ||||
| 			} | ||||
| 		} else { | ||||
| 			fd = fopen(psz_fullpath, "wb"); | ||||
| 			if (fd == NULL) { | ||||
| 				uprintf("  Unable to create file\n"); | ||||
| 				goto out; | ||||
| 			} | ||||
| 			i_file_length = udf_get_file_length(p_udf_dirent); | ||||
| 			while (i_file_length > 0) { | ||||
| 				memset(buf, 0, UDF_BLOCKSIZE); | ||||
| 				i_read = udf_read_block(p_udf_dirent, buf, 1); | ||||
| 				if (i_read < 0) { | ||||
| 					uprintf("  Error reading UDF file %s\n", &psz_fullpath[strlen(psz_extract_dir)]); | ||||
| 					goto out; | ||||
| 				} | ||||
| 				fwrite(buf, (size_t)MIN(i_file_length, i_read), 1, fd); | ||||
| 				if (ferror(fd)) { | ||||
| 					uprintf("  Error writing file\n"); | ||||
| 					goto out; | ||||
| 				} | ||||
| 				i_file_length -= i_read; | ||||
| 			} | ||||
| 			fclose(fd); | ||||
| 			fd = NULL; | ||||
| 		} | ||||
| 		free(psz_fullpath); | ||||
| 	} | ||||
| 	return 0; | ||||
| 
 | ||||
| out: | ||||
| 	if (fd != NULL) | ||||
| 		fclose(fd); | ||||
| 	free(psz_fullpath); | ||||
| 	return 1; | ||||
| } | ||||
| 
 | ||||
| static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | ||||
| { | ||||
| 	FILE *fd = NULL; | ||||
| 	int i_length, r = 1; | ||||
| 	char psz_fullpath[4096], *psz_basename; | ||||
| 	const char *psz_iso_name = &psz_fullpath[strlen(psz_extract_dir)]; | ||||
| 	unsigned char buf[ISO_BLOCKSIZE]; | ||||
| 	CdioListNode_t* p_entnode; | ||||
| 	iso9660_stat_t *p_statbuf; | ||||
| 	CdioList_t* p_entlist; | ||||
| 	size_t i; | ||||
| 	lsn_t lsn; | ||||
| 	int64_t i_file_length; | ||||
| 
 | ||||
| 	if ((p_iso == NULL) || (psz_path == NULL)) | ||||
| 		return 1; | ||||
| 
 | ||||
| 	i_length = _snprintf(psz_fullpath, sizeof(psz_fullpath), "%s%s/", psz_extract_dir, psz_path); | ||||
| 	if (i_length < 0) | ||||
| 		return 1; | ||||
| 	psz_basename = &psz_fullpath[i_length]; | ||||
| 
 | ||||
| 	p_entlist = iso9660_ifs_readdir(p_iso, psz_path); | ||||
| 	if (!p_entlist) | ||||
| 		return 1; | ||||
| 
 | ||||
| 	_CDIO_LIST_FOREACH (p_entnode, p_entlist) { | ||||
| 		p_statbuf = (iso9660_stat_t*) _cdio_list_node_data(p_entnode); | ||||
| 		/* Eliminate . and .. entries */ | ||||
| 		if ( (strcmp(p_statbuf->filename, ".") == 0) | ||||
| 			|| (strcmp(p_statbuf->filename, "..") == 0) ) | ||||
| 			continue; | ||||
| 		iso9660_name_translate(p_statbuf->filename, psz_basename); | ||||
| 		if (p_statbuf->type == _STAT_DIR) { | ||||
| 			_mkdir(psz_fullpath); | ||||
| 			if (iso_extract_files(p_iso, psz_iso_name)) | ||||
| 				goto out; | ||||
| 		} else { | ||||
| 			uprintf("Extracting: %s\n", psz_fullpath); | ||||
| 			fd = fopen(psz_fullpath, "wb"); | ||||
| 			if (fd == NULL) { | ||||
| 				uprintf("  Unable to create file\n"); | ||||
| 				goto out; | ||||
| 			} | ||||
| 			i_file_length = p_statbuf->size; | ||||
| 			for (i = 0; i_file_length > 0; i++) { | ||||
| 				memset(buf, 0, ISO_BLOCKSIZE); | ||||
| 				lsn = p_statbuf->lsn + (lsn_t)i; | ||||
| 				if (iso9660_iso_seek_read(p_iso, buf, lsn, 1) != ISO_BLOCKSIZE) { | ||||
| 					uprintf("  Error reading ISO9660 file %s at LSN %lu\n", | ||||
| 						psz_iso_name, (long unsigned int)lsn); | ||||
| 					goto out; | ||||
| 				} | ||||
| 				fwrite(buf, (size_t)MIN(i_file_length, ISO_BLOCKSIZE), 1, fd); | ||||
| 				if (ferror(fd)) { | ||||
| 					uprintf("  Error writing file\n"); | ||||
| 					goto out; | ||||
| 				} | ||||
| 				i_file_length -= ISO_BLOCKSIZE; | ||||
| 			} | ||||
| 			fclose(fd); | ||||
| 			fd = NULL; | ||||
| 		} | ||||
| 	} | ||||
| 	r = 0; | ||||
| 
 | ||||
| out: | ||||
| 	if (fd != NULL) | ||||
| 		fclose(fd); | ||||
| 	_cdio_list_free(p_entlist, true); | ||||
| 	return r; | ||||
| } | ||||
| 
 | ||||
| BOOL ExtractISO(const char* src_iso, const char* dest_dir) | ||||
| { | ||||
| 	BOOL r = FALSE; | ||||
| 	iso9660_t* p_iso = NULL; | ||||
| 	udf_t* p_udf = NULL;  | ||||
| 	udf_dirent_t* p_udf_root; | ||||
| 	char *psz_str = NULL; | ||||
| 	char vol_id[UDF_VOLID_SIZE] = ""; | ||||
| 	char volset_id[UDF_VOLSET_ID_SIZE+1] = ""; | ||||
| 
 | ||||
| 	cdio_loglevel_default = CDIO_LOG_DEBUG; | ||||
| 
 | ||||
| 	/* First try to open as UDF - fallback to ISO if it failed */ | ||||
| 	p_udf = udf_open(src_iso); | ||||
| 	if (p_udf == NULL) | ||||
| 		goto try_iso; | ||||
| 
 | ||||
| 	p_udf_root = udf_get_root(p_udf, true, 0); | ||||
| 	if (p_udf_root == NULL) { | ||||
| 		uprintf("Couldn't locate UDF root directory\n"); | ||||
| 		goto out; | ||||
| 	} | ||||
| 	vol_id[0] = 0; volset_id[0] = 0; | ||||
| 
 | ||||
| 	/* Show basic UDF Volume info */ | ||||
| 	if (udf_get_volume_id(p_udf, vol_id, sizeof(vol_id)) > 0) | ||||
| 		uprintf("Volume id: %s\n", vol_id); | ||||
| 	if (udf_get_volume_id(p_udf, volset_id, sizeof(volset_id)) >0 ) { | ||||
| 		volset_id[UDF_VOLSET_ID_SIZE]='\0'; | ||||
| 		uprintf("Volume set id: %s\n", volset_id); | ||||
| 	} | ||||
| 	uprintf("Partition number: %d\n", udf_get_part_number(p_udf)); | ||||
| 
 | ||||
| 	/* Recursively extract files */ | ||||
| 	r = udf_extract_files(p_udf, p_udf_root, ""); | ||||
| 
 | ||||
| 	goto out; | ||||
| 
 | ||||
| try_iso: | ||||
| 	p_iso = iso9660_open(src_iso); | ||||
| 	if (p_iso == NULL) { | ||||
| 		uprintf("Unable to open image '%s'.\n", src_iso); | ||||
| 		goto out; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Show basic ISO9660 info from the Primary Volume Descriptor. */ | ||||
| 	print_vd_info("Application", iso9660_ifs_get_application_id); | ||||
| 	print_vd_info("Preparer   ", iso9660_ifs_get_preparer_id); | ||||
| 	print_vd_info("Publisher  ", iso9660_ifs_get_publisher_id); | ||||
| 	print_vd_info("System     ", iso9660_ifs_get_system_id); | ||||
| 	print_vd_info("Volume     ", iso9660_ifs_get_volume_id); | ||||
| 	print_vd_info("Volume Set ", iso9660_ifs_get_volumeset_id); | ||||
| 
 | ||||
| 	r = iso_extract_files(p_iso, ""); | ||||
| 
 | ||||
| out: | ||||
| 	if (p_iso != NULL) | ||||
| 		iso9660_close(p_iso); | ||||
| 	if (p_udf != NULL) | ||||
| 		udf_close(p_udf); | ||||
| 
 | ||||
| 	return r; | ||||
| } | ||||
							
								
								
									
										146
									
								
								src/libcdio/cdio/audio.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								src/libcdio/cdio/audio.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,146 @@ | |||
| /* -*- c -*-
 | ||||
|     Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file audio.h 
 | ||||
|  * | ||||
|  *  \brief The top-level header for CD audio-related libcdio | ||||
|  *         calls.  These control playing of the CD-ROM through its  | ||||
|  *         line-out jack. | ||||
|  */ | ||||
| #ifndef __CDIO_AUDIO_H__ | ||||
| #define __CDIO_AUDIO_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*! This struct is used by the cdio_audio_read_subchannel */ | ||||
|   typedef struct cdio_subchannel_s  | ||||
|   { | ||||
|     uint8_t format; | ||||
|     uint8_t audio_status; | ||||
|     uint8_t address:	4; | ||||
|     uint8_t control:	4; | ||||
|     uint8_t track; | ||||
|     uint8_t index; | ||||
|     msf_t   abs_addr; | ||||
|     msf_t   rel_addr; | ||||
|   } cdio_subchannel_t; | ||||
|    | ||||
|   /*! This struct is used by cdio_audio_get_volume and cdio_audio_set_volume */ | ||||
|   typedef struct cdio_audio_volume_s | ||||
|   { | ||||
|     uint8_t level[4]; | ||||
|   } cdio_audio_volume_t; | ||||
|    | ||||
| 
 | ||||
|   /*! This struct is used by the CDROMPLAYTRKIND ioctl */ | ||||
|   typedef struct cdio_track_index_s | ||||
|   { | ||||
|     uint8_t	i_start_track;	/**< start track */ | ||||
|     uint8_t	i_start_index;	/**< start index */ | ||||
|     uint8_t	i_end_track;	/**< end track */ | ||||
|     uint8_t	i_end_index;	/**< end index */ | ||||
|   } cdio_track_index_t; | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get volume of an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_volume place to put the list of volume outputs levels | ||||
| 
 | ||||
|     p_volume can be NULL in which case we return only whether the driver | ||||
|     has the ability to get the volume or not. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio,  /*out*/ | ||||
| 					      cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Return the number of seconds (discarding frame portion) of an MSF  | ||||
|   */ | ||||
|   uint32_t cdio_audio_get_msf_seconds(msf_t *p_msf); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Pause playing CD through analog output | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_pause (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Playing CD through analog output at the given MSF. | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_start_msf pointer to staring MSF | ||||
|     @param p_end_msf pointer to ending MSF | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_play_msf (CdIo_t *p_cdio,  | ||||
| 					    /*in*/msf_t *p_start_msf, | ||||
| 					    /*in*/ msf_t *p_end_msf); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Playing CD through analog output at the desired track and index | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_track_index location to start/end. | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_play_track_index  | ||||
|   ( CdIo_t *p_cdio,  cdio_track_index_t *p_track_index); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get subchannel information. | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_subchannel place for returned subchannel information | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_read_subchannel (CdIo_t *p_cdio,  | ||||
| 						   /*out*/ cdio_subchannel_t *p_subchannel); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Resume playing an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_resume (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set volume of an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_volume place for returned volume-level information | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_set_volume (CdIo_t *p_cdio, /*out*/ | ||||
| 					      cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Stop playing an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_stop (CdIo_t *p_cdio); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_AUDIO_H__ */ | ||||
							
								
								
									
										220
									
								
								src/libcdio/cdio/bytesex.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										220
									
								
								src/libcdio/cdio/bytesex.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,220 @@ | |||
| /*
 | ||||
|     $Id: bytesex.h,v 1.5 2008/03/25 15:59:08 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> | ||||
|     Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| /** \file bytesex.h 
 | ||||
|  *  \brief  Generic Byte-swapping routines. | ||||
|  * | ||||
|  *   Note: this header will is slated to get removed and libcdio will | ||||
|  *   use glib.h routines instead. | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_BYTESEX_H__ | ||||
| #define __CDIO_BYTESEX_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/bytesex_asm.h> /* also defines CDIO_INLINE */ | ||||
| #include <cdio/logging.h> | ||||
| 
 | ||||
| /** 16-bit big-endian to little-endian */ | ||||
| #define UINT16_SWAP_LE_BE_C(val) ((uint16_t) ( \ | ||||
|     (((uint16_t) (val) & (uint16_t) 0x00ffU) << 8) | \ | ||||
|     (((uint16_t) (val) & (uint16_t) 0xff00U) >> 8))) | ||||
| 
 | ||||
| /** 32-bit big-endian to little-endian */ | ||||
| #define UINT32_SWAP_LE_BE_C(val) ((uint32_t) ( \ | ||||
|     (((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \ | ||||
|     (((uint32_t) (val) & (uint32_t) 0x0000ff00U) <<  8) | \ | ||||
|     (((uint32_t) (val) & (uint32_t) 0x00ff0000U) >>  8) | \ | ||||
|     (((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24))) | ||||
| 
 | ||||
| /** 64-bit big-endian to little-endian */ | ||||
| #define UINT64_SWAP_LE_BE_C(val) ((uint64_t) ( \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000000000ff)) << 56) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000000000ff00)) << 40) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000000000ff0000)) << 24) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000ff000000)) <<  8) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000ff00000000)) >>  8) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000ff0000000000)) >> 24) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0x00ff000000000000)) >> 40) | \ | ||||
|     (((uint64_t) (val) & (uint64_t) UINT64_C(0xff00000000000000)) >> 56))) | ||||
| 
 | ||||
| #ifndef UINT16_SWAP_LE_BE | ||||
| # define UINT16_SWAP_LE_BE UINT16_SWAP_LE_BE_C | ||||
| #endif | ||||
| 
 | ||||
| #ifndef UINT32_SWAP_LE_BE | ||||
| # define UINT32_SWAP_LE_BE UINT32_SWAP_LE_BE_C | ||||
| #endif | ||||
| 
 | ||||
| #ifndef UINT64_SWAP_LE_BE | ||||
| # define UINT64_SWAP_LE_BE UINT64_SWAP_LE_BE_C | ||||
| #endif | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint16_t uint16_swap_le_be (const uint16_t val) | ||||
| { | ||||
|   return UINT16_SWAP_LE_BE (val); | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint32_t uint32_swap_le_be (const uint32_t val) | ||||
| { | ||||
|   return UINT32_SWAP_LE_BE (val); | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint64_t uint64_swap_le_be (const uint64_t val) | ||||
| { | ||||
|   return UINT64_SWAP_LE_BE (val); | ||||
| } | ||||
| 
 | ||||
| # define UINT8_TO_BE(val)      ((uint8_t) (val)) | ||||
| # define UINT8_TO_LE(val)      ((uint8_t) (val)) | ||||
| #ifdef WORDS_BIGENDIAN | ||||
| # define UINT16_TO_BE(val)     ((uint16_t) (val)) | ||||
| # define UINT16_TO_LE(val)     ((uint16_t) UINT16_SWAP_LE_BE(val)) | ||||
| 
 | ||||
| # define UINT32_TO_BE(val)     ((uint32_t) (val)) | ||||
| # define UINT32_TO_LE(val)     ((uint32_t) UINT32_SWAP_LE_BE(val)) | ||||
| 
 | ||||
| # define UINT64_TO_BE(val)     ((uint64_t) (val)) | ||||
| # define UINT64_TO_LE(val)     ((uint64_t) UINT64_SWAP_LE_BE(val)) | ||||
| #else | ||||
| # define UINT16_TO_BE(val)     ((uint16_t) UINT16_SWAP_LE_BE(val)) | ||||
| # define UINT16_TO_LE(val)     ((uint16_t) (val)) | ||||
| 
 | ||||
| # define UINT32_TO_BE(val)     ((uint32_t) UINT32_SWAP_LE_BE(val)) | ||||
| # define UINT32_TO_LE(val)     ((uint32_t) (val)) | ||||
| 
 | ||||
| # define UINT64_TO_BE(val)     ((uint64_t) UINT64_SWAP_LE_BE(val)) | ||||
| # define UINT64_TO_LE(val)     ((uint64_t) (val)) | ||||
| #endif | ||||
| 
 | ||||
| /** symmetric conversions */ | ||||
| #define UINT8_FROM_BE(val)     (UINT8_TO_BE (val)) | ||||
| #define UINT8_FROM_LE(val)     (UINT8_TO_LE (val)) | ||||
| #define UINT16_FROM_BE(val)    (UINT16_TO_BE (val)) | ||||
| #define UINT16_FROM_LE(val)    (UINT16_TO_LE (val)) | ||||
| #define UINT32_FROM_BE(val)    (UINT32_TO_BE (val)) | ||||
| #define UINT32_FROM_LE(val)    (UINT32_TO_LE (val)) | ||||
| #define UINT64_FROM_BE(val)    (UINT64_TO_BE (val)) | ||||
| #define UINT64_FROM_LE(val)    (UINT64_TO_LE (val)) | ||||
| 
 | ||||
| /** converter function template */ | ||||
| #define CVT_TO_FUNC(bits) \ | ||||
|  static CDIO_INLINE uint ## bits ## _t \ | ||||
|  uint ## bits ## _to_be (uint ## bits ## _t val) \ | ||||
|  { return UINT ## bits ## _TO_BE (val); } \ | ||||
|  static CDIO_INLINE uint ## bits ## _t \ | ||||
|  uint ## bits ## _to_le (uint ## bits ## _t val) \ | ||||
|  { return UINT ## bits ## _TO_LE (val); } \ | ||||
| 
 | ||||
| CVT_TO_FUNC(8) | ||||
| CVT_TO_FUNC(16) | ||||
| CVT_TO_FUNC(32) | ||||
| CVT_TO_FUNC(64) | ||||
| 
 | ||||
| #undef CVT_TO_FUNC | ||||
| 
 | ||||
| #define uint8_from_be(val)     (uint8_to_be (val)) | ||||
| #define uint8_from_le(val)     (uint8_to_le (val)) | ||||
| #define uint16_from_be(val)    (uint16_to_be (val)) | ||||
| #define uint16_from_le(val)    (uint16_to_le (val)) | ||||
| #define uint32_from_be(val)    (uint32_to_be (val)) | ||||
| #define uint32_from_le(val)    (uint32_to_le (val)) | ||||
| #define uint64_from_be(val)    (uint64_to_be (val)) | ||||
| #define uint64_from_le(val)    (uint64_to_le (val)) | ||||
| 
 | ||||
| /** ISO9660-related field conversion routines */ | ||||
| 
 | ||||
| /** Convert from uint8_t to ISO 9660 7.1.1 format */ | ||||
| #define to_711(i)   uint8_to_le(i) | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.1.1 format to uint8_t */ | ||||
| #define from_711(i) uint8_from_le(i) | ||||
| 
 | ||||
| /** Convert from uint16_t to ISO 9669 7.2.1 format */ | ||||
| #define to_721(i)   uint16_to_le(i) | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.2.1 format to uint16_t */ | ||||
| #define from_721(i) uint16_from_le(i) | ||||
| 
 | ||||
| /** Convert from uint16_t to ISO 9669 7.2.2 format */ | ||||
| #define to_722(i)   uint16_to_be(i) | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.2.2 format to uint16_t */ | ||||
| #define from_722(i) uint16_from_be(i) | ||||
| 
 | ||||
| /** Convert from uint16_t to ISO 9669 7.2.3 format */ | ||||
| static CDIO_INLINE uint32_t | ||||
| to_723(uint16_t i) | ||||
| { | ||||
|   return uint32_swap_le_be(i) | i; | ||||
| } | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.2.3 format to uint16_t */ | ||||
| static CDIO_INLINE uint16_t  | ||||
| from_723 (uint32_t p) | ||||
| { | ||||
|   if (uint32_swap_le_be (p) != p) | ||||
|     cdio_warn ("from_723: broken byte order"); | ||||
| 
 | ||||
|   return (0xFFFF & p); | ||||
| } | ||||
| 
 | ||||
| /** Convert from uint16_t to ISO 9669 7.3.1 format */ | ||||
| #define to_731(i)   uint32_to_le(i) | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.3.1 format to uint32_t */ | ||||
| #define from_731(i) uint32_from_le(i) | ||||
| 
 | ||||
| /** Convert from uint32_t to ISO 9669 7.3.2 format */ | ||||
| #define to_732(i)   uint32_to_be(i) | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.3.2 format to uint32_t */ | ||||
| #define from_732(i) uint32_from_be(i) | ||||
| 
 | ||||
| /** Convert from uint16_t to ISO 9669 7.3.3 format */ | ||||
| static CDIO_INLINE uint64_t | ||||
| to_733(uint32_t i) | ||||
| { | ||||
|   return uint64_swap_le_be(i) | i; | ||||
| } | ||||
| 
 | ||||
| /** Convert from ISO 9660 7.3.3 format to uint32_t */ | ||||
| static CDIO_INLINE uint32_t  | ||||
| from_733 (uint64_t p) | ||||
| { | ||||
|   if (uint64_swap_le_be (p) != p) | ||||
|     cdio_warn ("from_733: broken byte order"); | ||||
|      | ||||
|   return (UINT32_C(0xFFFFFFFF) & p); | ||||
| } | ||||
| 
 | ||||
| #endif /* __CDIO_BYTESEX_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										142
									
								
								src/libcdio/cdio/bytesex_asm.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								src/libcdio/cdio/bytesex_asm.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,142 @@ | |||
| /*
 | ||||
|     $Id: bytesex_asm.h,v 1.3 2008/03/25 15:59:08 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|                   2001, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org> | ||||
|                   2001 Sven Ottemann <ac-logic@freenet.de> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| /** \file bytesex_asm.h 
 | ||||
|  *  \brief  Assembly code to handle byte-swapping. | ||||
| 
 | ||||
|     Note: this header will is slated to get removed and libcdio will use  | ||||
|     glib.h routines instead.  | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_BYTESEX_ASM_H__ | ||||
| #define __CDIO_BYTESEX_ASM_H__ | ||||
| #if !defined(DISABLE_ASM_OPTIMIZE) | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #if !defined CDIO_INLINE | ||||
| #if defined(__cplusplus) || defined(inline) | ||||
| #define CDIO_INLINE inline | ||||
| #elif defined(__GNUC__) | ||||
| #define CDIO_INLINE __inline__ | ||||
| #elif defined(_MSC_VER) | ||||
| #define CDIO_INLINE __inline | ||||
| #else | ||||
| #define CDIO_INLINE | ||||
| #endif | ||||
| #endif /* CDIO_INLINE */ | ||||
| 
 | ||||
| #if defined(__powerpc__) && defined(__GNUC__) | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint32_t uint32_swap_le_be_asm(const uint32_t a) | ||||
| { | ||||
|   uint32_t b; | ||||
| 
 | ||||
|   __asm__ ("lwbrx %0,0,%1" | ||||
|            :"=r"(b) | ||||
|            :"r"(&a), "m"(a)); | ||||
| 
 | ||||
|   return b; | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint16_t uint16_swap_le_be_asm(const uint16_t a) | ||||
| { | ||||
|   uint32_t b; | ||||
| 
 | ||||
|   __asm__ ("lhbrx %0,0,%1" | ||||
|            :"=r"(b) | ||||
|            :"r"(&a), "m"(a)); | ||||
| 
 | ||||
|   return b; | ||||
| } | ||||
| 
 | ||||
| #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm | ||||
| #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm | ||||
| 
 | ||||
| #elif defined(__mc68000__) &&  defined(__STORMGCC__) | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint32_t uint32_swap_le_be_asm(uint32_t a __asm__("d0")) | ||||
| { | ||||
|   /* __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); */ | ||||
| 
 | ||||
|   __asm__("move.l %1,d0;rol.w #8,d0;swap d0;rol.w #8,d0;move.l d0,%0" | ||||
|           :"=r"(a) | ||||
|           :"r"(a)); | ||||
| 
 | ||||
|   return(a); | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint16_t uint16_swap_le_be_asm(uint16_t a __asm__("d0")) | ||||
| { | ||||
|   __asm__("move.l %1,d0;rol.w #8,d0;move.l d0,%0" | ||||
|           :"=r"(a) | ||||
|           :"r"(a)); | ||||
|    | ||||
|   return(a); | ||||
| } | ||||
| 
 | ||||
| #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm | ||||
| #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm | ||||
| 
 | ||||
| #elif 0 && defined(__i386__) && defined(__GNUC__) | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint32_t uint32_swap_le_be_asm(uint32_t a) | ||||
| { | ||||
|   __asm__("xchgb %b0,%h0\n\t"     /* swap lower bytes     */ | ||||
| 	  "rorl $16,%0\n\t"       /* swap words           */ | ||||
| 	  "xchgb %b0,%h0"         /* swap higher bytes    */ | ||||
| 	  :"=q" (a) | ||||
| 	  : "0" (a)); | ||||
| 
 | ||||
|   return(a); | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE | ||||
| uint16_t uint16_swap_le_be_asm(uint16_t a) | ||||
| { | ||||
|   __asm__("xchgb %b0,%h0"         /* swap bytes           */  | ||||
| 	  : "=q" (a)  | ||||
| 	  :  "0" (a)); | ||||
|    | ||||
|   return(a); | ||||
| } | ||||
| 
 | ||||
| #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm | ||||
| #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| #endif /* !defined(DISABLE_ASM_OPTIMIZE) */ | ||||
| #endif /* __CDIO_BYTESEX_ASM_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										73
									
								
								src/libcdio/cdio/cdio.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								src/libcdio/cdio/cdio.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,73 @@ | |||
| /* -*- c -*-
 | ||||
|     Copyright (C) 2003, 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file cdio.h 
 | ||||
|  * | ||||
|  *  \brief The top-level header for libcdio: the CD Input and Control | ||||
|  *  library. Applications include this for anything regarding libcdio. | ||||
|  */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_H__ | ||||
| #define __CDIO_H__ | ||||
| 
 | ||||
| /** Application Interface or Protocol version number. If the public
 | ||||
|  *  interface changes, we increase this number. | ||||
|  */ | ||||
| #define CDIO_API_VERSION 5 | ||||
| 
 | ||||
| #include <cdio/version.h> | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/sector.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /* For compatibility. */ | ||||
| #define CdIo CdIo_t | ||||
|      | ||||
|   /** This is an opaque structure for the CD object. */ | ||||
|   typedef struct _CdIo CdIo_t;  | ||||
| 
 | ||||
|   typedef struct cdtext_s cdtext_t; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /* Drive(r)/Device-related functions. Perhaps we should break out 
 | ||||
|    Driver from device? | ||||
| */ | ||||
| #include <cdio/device.h> | ||||
| 
 | ||||
| /* Disc-related functions. */ | ||||
| #include <cdio/disc.h> | ||||
| 
 | ||||
| /* Sector (frame, or block)-related functions. Uses driver_return_code_t
 | ||||
|    from <cdio/device.h> so it should come after that.  | ||||
| */ | ||||
| #include <cdio/read.h> | ||||
| 
 | ||||
| /* CD-Text-related functions. */ | ||||
| #include <cdio/cdtext.h> | ||||
| 
 | ||||
| /* Track-related functions. */ | ||||
| #include <cdio/track.h> | ||||
| 
 | ||||
| #endif /* __CDIO_H__ */ | ||||
							
								
								
									
										1
									
								
								src/libcdio/cdio/cdtext.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/libcdio/cdio/cdtext.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| /* Empty placeholder */ | ||||
							
								
								
									
										1058
									
								
								src/libcdio/cdio/device.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1058
									
								
								src/libcdio/cdio/device.h
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										136
									
								
								src/libcdio/cdio/disc.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								src/libcdio/cdio/disc.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,136 @@ | |||
| /* -*- c -*-
 | ||||
| 
 | ||||
|     Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein | ||||
|     <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|    \file disc.h  | ||||
|    \brief  The top-level header for disc-related libcdio calls. | ||||
|  */ | ||||
| #ifndef __CDIO_DISC_H__ | ||||
| #define __CDIO_DISC_H__ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|     /**
 | ||||
|        disc modes. The first combined from MMC-5 6.33.3.13 (Send | ||||
|        CUESHEET), "DVD Book" from MMC-5 Table 400, page 419.  and | ||||
|        GNU/Linux /usr/include/linux/cdrom.h and we've added DVD. | ||||
|     */ | ||||
|   typedef enum { | ||||
|     CDIO_DISC_MODE_CD_DA,	    /**< CD-DA */ | ||||
|     CDIO_DISC_MODE_CD_DATA,	    /**< CD-ROM form 1 */ | ||||
|     CDIO_DISC_MODE_CD_XA,	    /**< CD-ROM XA form2 */ | ||||
|     CDIO_DISC_MODE_CD_MIXED,	    /**< Some combo of above. */ | ||||
|     CDIO_DISC_MODE_DVD_ROM,         /**< DVD ROM (e.g. movies) */ | ||||
|     CDIO_DISC_MODE_DVD_RAM,         /**< DVD-RAM */ | ||||
|     CDIO_DISC_MODE_DVD_R,           /**< DVD-R */ | ||||
|     CDIO_DISC_MODE_DVD_RW,          /**< DVD-RW */ | ||||
|     CDIO_DISC_MODE_HD_DVD_ROM,      /**< HD DVD-ROM */ | ||||
|     CDIO_DISC_MODE_HD_DVD_RAM,      /**< HD DVD-RAM */ | ||||
|     CDIO_DISC_MODE_HD_DVD_R,        /**< HD DVD-R */ | ||||
|     CDIO_DISC_MODE_DVD_PR,          /**< DVD+R */ | ||||
|     CDIO_DISC_MODE_DVD_PRW,         /**< DVD+RW */ | ||||
|     CDIO_DISC_MODE_DVD_PRW_DL,      /**< DVD+RW DL */ | ||||
|     CDIO_DISC_MODE_DVD_PR_DL,       /**< DVD+R DL */ | ||||
|     CDIO_DISC_MODE_DVD_OTHER,       /**< Unknown/unclassified DVD type */ | ||||
|     CDIO_DISC_MODE_NO_INFO, | ||||
|     CDIO_DISC_MODE_ERROR, | ||||
|     CDIO_DISC_MODE_CD_I	        /**< CD-i. */ | ||||
|   } discmode_t; | ||||
| 
 | ||||
|   extern const char *discmode2str[]; | ||||
|   /**
 | ||||
|     Get binary CD-Text information for a CdIo_t object. | ||||
| 
 | ||||
|     @param p_cdio the CD object that may contain CD-Text information. | ||||
|     @return malloc'd pointer to raw CD-Text data as stored on the disc  | ||||
|     or NULL if p_cdio is NULL or CD-Text information does not exist. | ||||
|     Return value should be freed when done with it and not NULL. | ||||
|   */ | ||||
|   uint8_t * cdio_get_cdtext_raw (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /** 
 | ||||
|     Get CD-Text information for a CdIo_t object. | ||||
|   | ||||
|     @param p_cdio the CD object that may contain CD-Text information. | ||||
|     @return the CD-Text object or NULL if p_cdio is NULL | ||||
|     or CD-Text information does not exist. | ||||
|   */ | ||||
|   cdtext_t *cdio_get_cdtext (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /** 
 | ||||
|     Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc. | ||||
|     that we've got. The notion of "CD" is extended a little to include | ||||
|     DVD's. | ||||
|   */ | ||||
|   discmode_t cdio_get_discmode (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /**
 | ||||
|     Get the lsn of the end of the CD | ||||
| 
 | ||||
|     @return the lsn. On error 0 or CDIO_INVALD_LSN. | ||||
|   */ | ||||
|   lsn_t cdio_get_disc_last_lsn(const CdIo_t *p_cdio); | ||||
|    | ||||
|   /**
 | ||||
|     Return the Joliet level recognized for p_cdio. | ||||
|   */ | ||||
|   uint8_t cdio_get_joliet_level(const CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /**
 | ||||
|     Get the media catalog number (MCN) from the CD. | ||||
| 
 | ||||
|     @return the media catalog number or NULL if there is none or we | ||||
|     don't have the ability to get it. | ||||
| 
 | ||||
|     Note: string is malloc'd so caller has to free() the returned | ||||
|     string when done with it. | ||||
| 
 | ||||
|   */ | ||||
|   char * cdio_get_mcn (const CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /**
 | ||||
|     Get the number of tracks on the CD. | ||||
| 
 | ||||
|     @return the number of tracks, or CDIO_INVALID_TRACK if there is | ||||
|     an error. | ||||
|   */ | ||||
|   track_t cdio_get_num_tracks (const CdIo_t *p_cdio); | ||||
|    | ||||
|   /**
 | ||||
|     Return true if discmode is some sort of CD. | ||||
|   */ | ||||
|   bool cdio_is_discmode_cdrom (discmode_t discmode); | ||||
|    | ||||
|   /**
 | ||||
|     Return true if discmode is some sort of DVD. | ||||
|   */ | ||||
|   bool cdio_is_discmode_dvd (discmode_t discmode); | ||||
|    | ||||
|   /**
 | ||||
|       cdio_stat_size is deprecated. @see cdio_get_disc_last_lsn   | ||||
|   */ | ||||
| #define cdio_stat_size cdio_get_disc_last_lsn | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_DISC_H__ */ | ||||
							
								
								
									
										98
									
								
								src/libcdio/cdio/ds.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								src/libcdio/cdio/ds.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,98 @@ | |||
| /*
 | ||||
|     $Id: ds.h,v 1.5 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file ds.h 
 | ||||
|  *  \brief  The top-level header for list-related data structures. | ||||
| 
 | ||||
|     Note: this header will is slated to get removed and libcdio will use  | ||||
|     glib.h routines instead.  | ||||
| */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_DS_H__ | ||||
| #define __CDIO_DS_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| /** opaque types... */ | ||||
| typedef struct _CdioList CdioList_t; | ||||
| typedef struct _CdioListNode CdioListNode_t; | ||||
| 
 | ||||
| typedef int (*_cdio_list_cmp_func_t) (void *p_data1, void *p_data2); | ||||
| typedef int (*_cdio_list_iterfunc_t) (void *p_data, void *p_user_data); | ||||
| 
 | ||||
| /** The below are given compatibility with old code. Please use
 | ||||
|     the above type names, not these. */ | ||||
| #define CdioList CdioList_t | ||||
| #define CdioListNode CdioListNode_t | ||||
| #define _cdio_list_cmp_func _cdio_list_cmp_func_t | ||||
| #define _cdio_list_iterfunc _cdio_list_iterfunc_t | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /** methods */ | ||||
| CdioList_t *_cdio_list_new (void); | ||||
| 
 | ||||
| void _cdio_list_free (CdioList_t *p_list, int free_data); | ||||
| 
 | ||||
| unsigned _cdio_list_length (const CdioList_t *list); | ||||
| 
 | ||||
| void _cdio_list_prepend (CdioList_t *p_list, void *p_data); | ||||
| 
 | ||||
| void _cdio_list_append (CdioList_t *p_list, void *p_data); | ||||
| 
 | ||||
| void _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func,  | ||||
|                          void *p_user_data); | ||||
| 
 | ||||
| CdioListNode_t *_cdio_list_find (CdioList_t *p_list,  | ||||
|                                  _cdio_list_iterfunc_t cmp_func,  | ||||
|                                  void *p_user_data); | ||||
| 
 | ||||
| #define _CDIO_LIST_FOREACH(node, list) \ | ||||
|  for (node = _cdio_list_begin (list); node; node = _cdio_list_node_next (node)) | ||||
| 
 | ||||
| /** node operations */ | ||||
| 
 | ||||
| CdioListNode_t *_cdio_list_begin (const CdioList_t *p_list); | ||||
| 
 | ||||
| CdioListNode_t *_cdio_list_end (CdioList_t *p_list); | ||||
| 
 | ||||
| CdioListNode_t *_cdio_list_node_next (CdioListNode_t *p_node); | ||||
| 
 | ||||
| void _cdio_list_node_free (CdioListNode_t *p_node, int i_free_data); | ||||
| 
 | ||||
| void *_cdio_list_node_data (CdioListNode_t *p_node); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_DS_H__ */ | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
| 
 | ||||
							
								
								
									
										127
									
								
								src/libcdio/cdio/dvd.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								src/libcdio/cdio/dvd.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,127 @@ | |||
| /*
 | ||||
|     Copyright (C) 2004, 2010 Rocky Bernstein <rocky@gnu.org> | ||||
|     Modeled after GNU/Linux definitions in linux/cdrom.h | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|    \file dvd.h  | ||||
|    \brief Definitions for DVD access. | ||||
| 
 | ||||
|    The documents we make use of are described Multi-Media Commands | ||||
|    (MMC). This document generally has a numeric level number | ||||
|    appended. For example MMC-5 refers to ``Multi-Media Commands - 5' | ||||
|    which is the current version in 2010. | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_DVD_H__ | ||||
| #define __CDIO_DVD_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| /**
 | ||||
|    Values used in a READ DVD STRUCTURE | ||||
|  */ | ||||
| 
 | ||||
| #define CDIO_DVD_STRUCT_PHYSICAL	0x00 | ||||
| #define CDIO_DVD_STRUCT_COPYRIGHT	0x01 | ||||
| #define CDIO_DVD_STRUCT_DISCKEY	        0x02 | ||||
| #define CDIO_DVD_STRUCT_BCA		0x03 | ||||
| #define CDIO_DVD_STRUCT_MANUFACT	0x04 | ||||
| 
 | ||||
| /**
 | ||||
|     Media definitions for "DVD Book" from MMC-5 Table 400, page 419. | ||||
| */ | ||||
| #define CDIO_DVD_BOOK_DVD_ROM     0x0 /**< DVD-ROM */ | ||||
| #define CDIO_DVD_BOOK_DVD_RAM     0x1 /**< DVD-RAM */ | ||||
| #define CDIO_DVD_BOOK_DVD_R       0x2 /**< DVD-R */ | ||||
| #define CDIO_DVD_BOOK_DVD_RW      0x3 /**< DVD-RW */ | ||||
| #define CDIO_DVD_BOOK_HD_DVD_ROM  0x4 /**< HD DVD-ROM */ | ||||
| #define CDIO_DVD_BOOK_HD_DVD_RAM  0x5 /**< HD DVD-RAM */ | ||||
| #define CDIO_DVD_BOOK_HD_DVD_R    0x6 /**< HD DVD-R */ | ||||
| #define CDIO_DVD_BOOK_DVD_PRW     0x9 /**< DVD+RW */ | ||||
| #define CDIO_DVD_BOOK_DVD_PR      0xa /**< DVD+R  */ | ||||
| #define CDIO_DVD_BOOK_DVD_PRW_DL  0xd /**< DVD+RW DL  */ | ||||
| #define CDIO_DVD_BOOK_DVD_PR_DL   0xe /**< DVD+R DL  */ | ||||
| 
 | ||||
| typedef struct cdio_dvd_layer { | ||||
|   unsigned int book_version	: 4; | ||||
|   unsigned int book_type	: 4; | ||||
|   unsigned int min_rate	        : 4; | ||||
|   unsigned int disc_size	: 4; | ||||
|   unsigned int layer_type	: 4; | ||||
|   unsigned int track_path	: 1; | ||||
|   unsigned int nlayers	        : 2; | ||||
|   unsigned int track_density	: 4; | ||||
|   unsigned int linear_density   : 4; | ||||
|   unsigned int bca		: 1; | ||||
|   uint32_t start_sector; | ||||
|   uint32_t end_sector; | ||||
|   uint32_t end_sector_l0; | ||||
| } cdio_dvd_layer_t; | ||||
| 
 | ||||
| /**
 | ||||
|     Maximum number of layers in a DVD.   | ||||
|  */ | ||||
| #define CDIO_DVD_MAX_LAYERS	4 | ||||
| 
 | ||||
| typedef struct cdio_dvd_physical { | ||||
|   uint8_t type; | ||||
|   uint8_t layer_num; | ||||
|   cdio_dvd_layer_t layer[CDIO_DVD_MAX_LAYERS]; | ||||
| } cdio_dvd_physical_t; | ||||
| 
 | ||||
| typedef struct cdio_dvd_copyright { | ||||
|   uint8_t type; | ||||
|    | ||||
|   uint8_t layer_num; | ||||
|   uint8_t cpst; | ||||
|   uint8_t rmi; | ||||
| } cdio_dvd_copyright_t; | ||||
| 
 | ||||
| typedef struct cdio_dvd_disckey { | ||||
|   uint8_t type; | ||||
|    | ||||
|   unsigned agid	: 2; | ||||
|   uint8_t value[2048]; | ||||
| } cdio_dvd_disckey_t; | ||||
| 
 | ||||
| typedef struct cdio_dvd_bca { | ||||
|   uint8_t type; | ||||
|    | ||||
|   int len; | ||||
|   uint8_t value[188]; | ||||
| } cdio_dvd_bca_t; | ||||
| 
 | ||||
| typedef struct cdio_dvd_manufact { | ||||
|   uint8_t type; | ||||
|    | ||||
|   uint8_t layer_num; | ||||
|   int len; | ||||
|   uint8_t value[2048]; | ||||
| } cdio_dvd_manufact_t; | ||||
| 
 | ||||
| typedef union { | ||||
|   uint8_t type; | ||||
|    | ||||
|   cdio_dvd_physical_t	physical; | ||||
|   cdio_dvd_copyright_t	copyright; | ||||
|   cdio_dvd_disckey_t	disckey; | ||||
|   cdio_dvd_bca_t	bca; | ||||
|   cdio_dvd_manufact_t	manufact; | ||||
| } cdio_dvd_struct_t; | ||||
| 
 | ||||
| #endif /* __CDIO_DVD_H__ */ | ||||
							
								
								
									
										1018
									
								
								src/libcdio/cdio/ecma_167.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1018
									
								
								src/libcdio/cdio/ecma_167.h
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1144
									
								
								src/libcdio/cdio/iso9660.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1144
									
								
								src/libcdio/cdio/iso9660.h
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										140
									
								
								src/libcdio/cdio/logging.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								src/libcdio/cdio/logging.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,140 @@ | |||
| /*
 | ||||
|     $Id: logging.h,v 1.11 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2003, 2004, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file logging.h 
 | ||||
|  *  \brief Header to control logging and level of detail of output. | ||||
|  *          | ||||
|  */ | ||||
|  | ||||
| #ifndef __LOGGING_H__ | ||||
| #define __LOGGING_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| /**
 | ||||
|  * The different log levels supported. | ||||
|  */ | ||||
| typedef enum { | ||||
|   CDIO_LOG_DEBUG = 1, /**< Debug-level messages - helps debug what's up. */ | ||||
|   CDIO_LOG_INFO,      /**< Informational - indicates perhaps something of 
 | ||||
|                            interest. */ | ||||
|   CDIO_LOG_WARN,      /**< Warning conditions - something that looks funny. */ | ||||
|   CDIO_LOG_ERROR,     /**< Error conditions - may terminate program.  */ | ||||
|   CDIO_LOG_ASSERT     /**< Critical conditions - may abort program. */ | ||||
| } cdio_log_level_t; | ||||
| 
 | ||||
| /**
 | ||||
|  * The place to save the preference concerning how much verbosity  | ||||
|  * is desired. This is used by the internal default log handler, but | ||||
|  * it could be use by applications which provide their own log handler. | ||||
|  */ | ||||
| extern cdio_log_level_t cdio_loglevel_default; | ||||
| 
 | ||||
| /**
 | ||||
|  * This type defines the signature of a log handler.  For every | ||||
|  * message being logged, the handler will receive the log level and | ||||
|  * the message string. | ||||
|  * | ||||
|  * @see cdio_log_set_handler | ||||
|  * @see cdio_log_level_t | ||||
|  * | ||||
|  * @param level   The log level. | ||||
|  * @param message The log message. | ||||
|  */ | ||||
| typedef void (*cdio_log_handler_t) (cdio_log_level_t level,  | ||||
|                                     const char message[]); | ||||
| 
 | ||||
| /**
 | ||||
|  * Set a custom log handler for libcdio.  The return value is the log | ||||
|  * handler being replaced.  If the provided parameter is NULL, then | ||||
|  * the handler will be reset to the default handler. | ||||
|  * | ||||
|  * @see cdio_log_handler_t | ||||
|  * | ||||
|  * @param new_handler The new log handler. | ||||
|  * @return The previous log handler. | ||||
|  */ | ||||
| cdio_log_handler_t cdio_log_set_handler (cdio_log_handler_t new_handler); | ||||
| 
 | ||||
| /**
 | ||||
|  * Handle an message with the given log level. | ||||
|  * | ||||
|  * @see cdio_debug | ||||
|  * @see cdio_info | ||||
|  * @see cdio_warn | ||||
|  * @see cdio_error | ||||
| 
 | ||||
|  * @param level   The log level. | ||||
|  * @param format  printf-style format string | ||||
|  * @param ...     remaining arguments needed by format string | ||||
|  */ | ||||
| void cdio_log (cdio_log_level_t level,  | ||||
|                const char format[], ...) GNUC_PRINTF(2, 3); | ||||
| #if defined(__GNUC__) | ||||
| /* See http://clang-analyzer.llvm.org/annotations.html#custom_assertions */ | ||||
| void cdio_assert_log (const char format[], ...) | ||||
|                GNUC_PRINTF(1, 2) __attribute__((__noreturn__)); | ||||
| #endif | ||||
| /**
 | ||||
|  * Handle a debugging message. | ||||
|  * | ||||
|  * @see cdio_log for a more generic routine | ||||
|  */ | ||||
| void cdio_debug (const char format[], ...) GNUC_PRINTF(1,2); | ||||
| 
 | ||||
| /**
 | ||||
|  * Handle an informative message. | ||||
|  * | ||||
|  * @see cdio_log for a more generic routine | ||||
|  */ | ||||
| void cdio_info (const char format[], ...) GNUC_PRINTF(1,2); | ||||
| 
 | ||||
| /**
 | ||||
|  * Handle a warning message. | ||||
|  * | ||||
|  * @see cdio_log for a more generic routine | ||||
|  */ | ||||
| void cdio_warn (const char format[], ...) GNUC_PRINTF(1,2); | ||||
| 
 | ||||
| /**
 | ||||
|  * Handle an error message. Execution is terminated. | ||||
|  * | ||||
|  * @see cdio_log for a more generic routine. | ||||
|  */ | ||||
| void cdio_error (const char format[], ...) GNUC_PRINTF(1,2); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __LOGGING_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										43
									
								
								src/libcdio/cdio/posix.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/libcdio/cdio/posix.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| /*
 | ||||
|     $Id: posix.h,v 1.2 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*!
 | ||||
|  * \file posix.h  | ||||
|  * | ||||
|  * \brief various POSIX definitions. | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_POSIX_H__ | ||||
| #define __CDIO_POSIX_H__ | ||||
| 
 | ||||
| typedef uint32_t posix_mode_t; | ||||
| typedef uint32_t posix_nlink_t; | ||||
| typedef uint32_t posix_uid_t; | ||||
| typedef uint32_t posix_gid_t; | ||||
| typedef uint16_t unicode16_t; | ||||
| 
 | ||||
| #endif /* __CDIO_POSIX_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										226
									
								
								src/libcdio/cdio/read.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										226
									
								
								src/libcdio/cdio/read.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,226 @@ | |||
| /*
 | ||||
|     $Id: read.h,v 1.15 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file read.h 
 | ||||
|  * | ||||
|  *  \brief The top-level header for sector (block, frame)-related | ||||
|  *  libcdio calls.  | ||||
|  */ | ||||
| 
 | ||||
| #ifndef __CDIO_READ_H__ | ||||
| #define __CDIO_READ_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /** All the different ways a block/sector can be read. */ | ||||
|   typedef enum { | ||||
|     CDIO_READ_MODE_AUDIO,  /**< CD-DA, audio, Red Book */ | ||||
|     CDIO_READ_MODE_M1F1,   /**< Mode 1 Form 1 */ | ||||
|     CDIO_READ_MODE_M1F2,   /**< Mode 1 Form 2 */ | ||||
|     CDIO_READ_MODE_M2F1,   /**< Mode 2 Form 1 */ | ||||
|     CDIO_READ_MODE_M2F2    /**< Mode 2 Form 2 */ | ||||
|   } cdio_read_mode_t; | ||||
|    | ||||
|   /*!
 | ||||
|     Reposition read offset | ||||
|     Similar to (if not the same as) libc's fseek() | ||||
| 
 | ||||
|     @param p_cdio object which gets adjusted | ||||
|     @param offset amount to seek | ||||
|     @param whence  like corresponding parameter in libc's fseek, e.g.  | ||||
|                    SEEK_SET or SEEK_END. | ||||
|     @return (off_t) -1 on error.  | ||||
|   */ | ||||
| 
 | ||||
|   off_t cdio_lseek(const CdIo_t *p_cdio, off_t offset, int whence); | ||||
|      | ||||
|   /*!  Reads into buf the next size bytes.  Similar to (if not the
 | ||||
|     same as) libc's read(). This is a "cooked" read, or one handled by | ||||
|     the OS. It probably won't work on audio data. For that use | ||||
|     cdio_read_audio_sector(s). | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|                  this location can store at least i_size bytes. | ||||
|     @param i_size number of bytes to read | ||||
| 
 | ||||
|     @return (ssize_t) -1 on error.  | ||||
|   */ | ||||
|   ssize_t cdio_read(const CdIo_t *p_cdio, void *p_buf, size_t i_size); | ||||
|      | ||||
|   /*!
 | ||||
|     Read an audio sector | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|                  this location can store at least CDIO_FRAMESIZE_RAW | ||||
| 		 bytes. | ||||
|     @param i_lsn sector to read | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_audio_sector (const CdIo_t *p_cdio,  | ||||
| 					       void *p_buf, lsn_t i_lsn); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads audio sectors | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|                  this location can store at least CDIO_FRAMESIZE_RAW | ||||
| 		 * i_blocks bytes. | ||||
|     @param i_lsn sector to read | ||||
|     @param i_blocks number of sectors to read | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_audio_sectors (const CdIo_t *p_cdio,  | ||||
| 						void *p_buf, lsn_t i_lsn, | ||||
| 						uint32_t i_blocks); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Read data sectors | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into.  The caller should make sure | ||||
|                  this location can store at least ISO_BLOCKSIZE,  | ||||
| 		 M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending | ||||
| 		 on the kind of sector getting read. If you don't  | ||||
| 		 know whether you have a Mode 1/2, Form 1/ Form 2/Formless | ||||
| 		 sector best to reserve space for the maximum,  | ||||
| 		 M2RAW_SECTOR_SIZE. | ||||
|     @param i_lsn sector to read | ||||
|     @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,  | ||||
|     M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. | ||||
| 
 | ||||
|     @param i_blocks number of blocks to read | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_data_sectors ( const CdIo_t *p_cdio,  | ||||
| 						void *p_buf, lsn_t i_lsn, | ||||
| 						uint16_t i_blocksize, | ||||
| 						uint32_t i_blocks ); | ||||
|   /*!
 | ||||
|     Reads a mode 1 sector | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. | ||||
|     @param i_lsn sector to read | ||||
|     @param b_form2 true for reading mode 1 form 2 sectors or false for  | ||||
|     mode 1 form 1 sectors. | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_mode1_sector (const CdIo_t *p_cdio,  | ||||
| 					       void *p_buf, lsn_t i_lsn,  | ||||
| 					       bool b_form2); | ||||
|   /*!
 | ||||
|     Reads mode 1 sectors | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into | ||||
|     @param i_lsn sector to read | ||||
|     @param b_form2 true for reading mode 1 form 2 sectors or false for  | ||||
|     mode 1 form 1 sectors. | ||||
|     @param i_blocks number of sectors to read | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_mode1_sectors (const CdIo_t *p_cdio,  | ||||
| 						void *p_buf, lsn_t i_lsn,  | ||||
| 						bool b_form2,  | ||||
| 						uint32_t i_blocks); | ||||
|   /*!
 | ||||
|     Reads a mode 2 sector | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|                  this location can store at least  | ||||
| 		 M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for  | ||||
| 		 form 2) bytes. | ||||
|     @param i_lsn sector to read | ||||
|     @param b_form2 true for reading mode 2 form 2 sectors or false for  | ||||
|     mode 2 form 1 sectors. | ||||
| 
 | ||||
|     @return 0 if no error, nonzero otherwise. | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_mode2_sector (const CdIo_t *p_cdio,  | ||||
| 					       void *p_buf, lsn_t i_lsn,  | ||||
| 					       bool b_form2); | ||||
|    | ||||
|   /** The special case of reading a single block is a common one so we
 | ||||
|       provide a routine for that as a convenience. | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_sector(const CdIo_t *p_cdio, void *p_buf,  | ||||
| 					lsn_t i_lsn,  | ||||
| 					cdio_read_mode_t read_mode); | ||||
|   /*!
 | ||||
|     Reads mode 2 sectors | ||||
| 
 | ||||
|     @param p_cdio object to read from | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|                  this location can store at least  | ||||
| 		 M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for  | ||||
| 		 form 2) * i_blocks bytes. | ||||
|     @param i_lsn sector to read | ||||
|     @param b_form2 true for reading mode2 form 2 sectors or false for  | ||||
|            mode 2  form 1 sectors. | ||||
|     @param i_blocks number of sectors to read | ||||
| 
 | ||||
|     @return 0 if no error, nonzero otherwise. | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_mode2_sectors (const CdIo_t *p_cdio,  | ||||
| 						void *p_buf, lsn_t i_lsn,  | ||||
| 						bool b_form2,  | ||||
| 						uint32_t i_blocks); | ||||
|    | ||||
|   /*!
 | ||||
|     Reads a number of sectors (AKA blocks). | ||||
| 
 | ||||
|     @param p_cdio cdio object | ||||
|     @param p_buf place to read data into. The caller should make sure | ||||
|     this location is large enough. See below for size information. | ||||
|     @param read_mode the kind of "mode" to use in reading. | ||||
|     @param i_lsn sector to read | ||||
|     @param i_blocks number of sectors to read | ||||
|     @return DRIVER_OP_SUCCESS (0) if no error, other (negative) enumerations | ||||
|     are returned on error. | ||||
| 
 | ||||
|     If read_mode is CDIO_MODE_AUDIO, | ||||
|       *p_buf should hold at least CDIO_FRAMESIZE_RAW * i_blocks bytes. | ||||
| 
 | ||||
|     If read_mode is CDIO_MODE_DATA, | ||||
|       *p_buf should hold at least i_blocks times either ISO_BLOCKSIZE,  | ||||
|       M1RAW_SECTOR_SIZE or M2F2_SECTOR_SIZE depending on the kind of  | ||||
|       sector getting read. If you don't know whether you have a Mode 1/2,  | ||||
|     Form 1/ Form 2/Formless sector best to reserve space for the maximum | ||||
|     which is M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|     If read_mode is CDIO_MODE_M2F1, | ||||
|     *p_buf should hold at least M2RAW_SECTOR_SIZE * i_blocks bytes. | ||||
|      | ||||
|     If read_mode is CDIO_MODE_M2F2, | ||||
|     *p_buf should hold at least CDIO_CD_FRAMESIZE * i_blocks bytes. | ||||
|      | ||||
|   */ | ||||
|   driver_return_code_t cdio_read_sectors(const CdIo_t *p_cdio, void *p_buf,  | ||||
| 					 lsn_t i_lsn,  | ||||
| 					 cdio_read_mode_t read_mode, | ||||
| 					 uint32_t i_blocks); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_TRACK_H__ */ | ||||
							
								
								
									
										384
									
								
								src/libcdio/cdio/rock.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										384
									
								
								src/libcdio/cdio/rock.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,384 @@ | |||
| /*
 | ||||
|     Copyright (C) 2005, 2006 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     See also rock.c by Eric Youngdale (1993) from GNU/Linux  | ||||
|     This is Copyright 1993 Yggdrasil Computing, Incorporated | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*!
 | ||||
|    \file rock.h  | ||||
|    \brief Things related to the Rock Ridge Interchange Protocol (RRIP) | ||||
| 
 | ||||
|    Applications will probably not include this directly but via  | ||||
|    the iso9660.h header. | ||||
| */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_ROCK_H__ | ||||
| #define __CDIO_ROCK_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /*! An enumeration for some of the ISO_ROCK_* \#defines below. This isn't
 | ||||
|   really an enumeration one would really use in a program it is to | ||||
|   be helpful in debuggers where wants just to refer to the ISO_ROCK_* | ||||
|   names and get something. | ||||
| */ | ||||
| extern enum iso_rock_enums { | ||||
|   ISO_ROCK_IRUSR  = 000400,   /**< read permission (owner) */ | ||||
|   ISO_ROCK_IWUSR  = 000200,   /**< write permission (owner) */ | ||||
|   ISO_ROCK_IXUSR  = 000100,   /**< execute permission (owner) */ | ||||
|   ISO_ROCK_IRGRP  = 000040,   /**< read permission (group) */ | ||||
|   ISO_ROCK_IWGRP  = 000020,   /**< write permission (group) */ | ||||
|   ISO_ROCK_IXGRP  = 000010,   /**< execute permission (group) */ | ||||
|   ISO_ROCK_IROTH  = 000004,   /**< read permission (other) */ | ||||
|   ISO_ROCK_IWOTH  = 000002,   /**< write permission (other) */ | ||||
|   ISO_ROCK_IXOTH  = 000001,   /**< execute permission (other) */ | ||||
| 
 | ||||
|   ISO_ROCK_ISUID  = 004000,   /**< set user ID on execution */ | ||||
|   ISO_ROCK_ISGID  = 002000,   /**< set group ID on execution */ | ||||
|   ISO_ROCK_ISVTX  = 001000,   /**< save swapped text even after use */ | ||||
| 
 | ||||
|   ISO_ROCK_ISSOCK = 0140000,  /**< socket */ | ||||
|   ISO_ROCK_ISLNK  = 0120000,  /**< symbolic link */ | ||||
|   ISO_ROCK_ISREG  = 0100000,  /**< regular */ | ||||
|   ISO_ROCK_ISBLK  = 060000,   /**< block special */ | ||||
|   ISO_ROCK_ISCHR  = 020000,   /**< character special */ | ||||
|   ISO_ROCK_ISDIR  = 040000,   /**< directory */ | ||||
|   ISO_ROCK_ISFIFO = 010000    /**< pipe or FIFO */ | ||||
| } iso_rock_enums; | ||||
| 
 | ||||
| #define ISO_ROCK_IRUSR    000400  /** read permission (owner) */ | ||||
| #define ISO_ROCK_IWUSR    000200  /** write permission (owner) */ | ||||
| #define ISO_ROCK_IXUSR    000100  /** execute permission (owner) */ | ||||
| #define ISO_ROCK_IRGRP    000040  /** read permission (group) */ | ||||
| #define ISO_ROCK_IWGRP    000020  /** write permission (group) */ | ||||
| #define ISO_ROCK_IXGRP    000010  /** execute permission (group) */ | ||||
| #define ISO_ROCK_IROTH    000004  /** read permission (other) */ | ||||
| #define ISO_ROCK_IWOTH    000002  /** write permission (other) */ | ||||
| #define ISO_ROCK_IXOTH    000001  /** execute permission (other) */ | ||||
| 
 | ||||
| #define ISO_ROCK_ISUID    004000  /** set user ID on execution */ | ||||
| #define ISO_ROCK_ISGID    002000  /** set group ID on execution */ | ||||
| #define ISO_ROCK_ISVTX    001000  /** save swapped text even after use */ | ||||
| 
 | ||||
| #define ISO_ROCK_ISSOCK  0140000  /** socket */ | ||||
| #define ISO_ROCK_ISLNK   0120000  /** symbolic link */ | ||||
| #define ISO_ROCK_ISREG   0100000  /** regular */ | ||||
| #define ISO_ROCK_ISBLK    060000  /** block special */ | ||||
| #define ISO_ROCK_ISCHR    020000  /** character special */ | ||||
| #define ISO_ROCK_ISDIR    040000  /** directory */ | ||||
| #define ISO_ROCK_ISFIFO   010000  /** pipe or FIFO */ | ||||
| 
 | ||||
| /** Enforced file locking (shared w/set group ID) */ | ||||
| #define ISO_ROCK_ENFMT ISO_ROCK_ISGID | ||||
| 
 | ||||
| PRAGMA_BEGIN_PACKED | ||||
| 
 | ||||
| /*! The next two structs are used by the system-use-sharing protocol
 | ||||
|    (SUSP), in which the Rock Ridge extensions are embedded.  It is | ||||
|    quite possible that other extensions are present on the disk, and | ||||
|    this is fine as long as they all use SUSP. */ | ||||
| 
 | ||||
| /*! system-use-sharing protocol */ | ||||
| typedef struct iso_su_sp_s{ | ||||
|   unsigned char magic[2]; | ||||
|   uint8_t       skip; | ||||
| } GNUC_PACKED iso_su_sp_t; | ||||
| 
 | ||||
| /*! system-use extension record */ | ||||
| typedef struct iso_su_er_s { | ||||
|   iso711_t      len_id;  /**< Identifier length. Value 10?. */ | ||||
|   unsigned char len_des; | ||||
|   unsigned char len_src; | ||||
|   iso711_t      ext_ver; /**< Extension version. Value 1? */ | ||||
|   char data[EMPTY_ARRAY_SIZE]; | ||||
| } GNUC_PACKED iso_su_er_t; | ||||
| 
 | ||||
| typedef struct iso_su_ce_s { | ||||
|   char extent[8]; | ||||
|   char offset[8]; | ||||
|   char size[8]; | ||||
| } iso_su_ce_t; | ||||
| 
 | ||||
| /*! POSIX file attributes, PX. See Rock Ridge Section 4.1.2 */ | ||||
| typedef struct iso_rock_px_s { | ||||
|   iso733_t st_mode;       /*! file mode permissions; same as st_mode 
 | ||||
|                             of POSIX:5.6.1 */ | ||||
|   iso733_t st_nlinks;     /*! number of links to file; same as st_nlinks
 | ||||
|                             of POSIX:5.6.1 */ | ||||
|   iso733_t st_uid;        /*! user id owner of file; same as st_uid
 | ||||
|                             of POSIX:5.6.1 */ | ||||
|   iso733_t st_gid;        /*! group id of file; same as st_gid of 
 | ||||
|                             of POSIX:5.6.1 */ | ||||
| } GNUC_PACKED iso_rock_px_t ; | ||||
| 
 | ||||
| /*! POSIX device number, PN. A PN is mandatory if the file type
 | ||||
|   recorded in the "PX" File Mode field for a Directory Record | ||||
|   indicates a character or block device (ISO_ROCK_ISCHR | | ||||
|   ISO_ROCK_ISBLK).  This entry is ignored for other (non-Direcotry) | ||||
|   file types. No more than one "PN" is recorded in the System Use Area | ||||
|   of a Directory Record. | ||||
| 
 | ||||
|   See Rock Ridge Section 4.1.2 */ | ||||
| typedef struct iso_rock_pn_s { | ||||
|   iso733_t dev_high;     /**< high-order 32 bits of the 64 bit device number.
 | ||||
|                             7.2.3 encoded */ | ||||
|   iso733_t dev_low;      /**< low-order 32 bits of the 64 bit device number.
 | ||||
|                             7.2.3 encoded */ | ||||
| } GNUC_PACKED iso_rock_pn_t ; | ||||
| 
 | ||||
| /*! These are the bits and their meanings for flags in the SL structure. */ | ||||
| typedef enum { | ||||
|   ISO_ROCK_SL_CONTINUE = 1, | ||||
|   ISO_ROCK_SL_CURRENT  = 2, | ||||
|   ISO_ROCK_SL_PARENT   = 4, | ||||
|   ISO_ROCK_SL_ROOT     = 8 | ||||
| } iso_rock_sl_flag_t; | ||||
| 
 | ||||
| #define	ISO_ROCK_SL_CONTINUE 1 | ||||
| #define	ISO_ROCK_SL_CURRENT  2 | ||||
| #define	ISO_ROCK_SL_PARENT   4 | ||||
| #define	ISO_ROCK_SL_ROOT     8 | ||||
| 
 | ||||
| typedef struct iso_rock_sl_part_s { | ||||
|   uint8_t flags; | ||||
|   uint8_t len; | ||||
|   char text[EMPTY_ARRAY_SIZE]; | ||||
| } GNUC_PACKED iso_rock_sl_part_t ; | ||||
| 
 | ||||
| /*! Symbolic link. See Rock Ridge Section 4.1.3 */ | ||||
| typedef struct iso_rock_sl_s { | ||||
|   unsigned char flags; | ||||
|   iso_rock_sl_part_t link; | ||||
| } GNUC_PACKED iso_rock_sl_t ; | ||||
| 
 | ||||
| /*! Alternate name. See Rock Ridge Section 4.1.4 */ | ||||
| 
 | ||||
| /*! These are the bits and their meanings for flags in the NM structure. */ | ||||
| typedef enum { | ||||
|   ISO_ROCK_NM_CONTINUE = 1, | ||||
|   ISO_ROCK_NM_CURRENT  = 2, | ||||
|   ISO_ROCK_NM_PARENT   = 4, | ||||
| } iso_rock_nm_flag_t; | ||||
| 
 | ||||
| #define	ISO_ROCK_NM_CONTINUE 1 | ||||
| #define	ISO_ROCK_NM_CURRENT  2 | ||||
| #define	ISO_ROCK_NM_PARENT   4 | ||||
| 
 | ||||
| 
 | ||||
| typedef struct iso_rock_nm_s { | ||||
|   unsigned char flags; | ||||
|   char name[EMPTY_ARRAY_SIZE]; | ||||
| } GNUC_PACKED iso_rock_nm_t ; | ||||
| 
 | ||||
| /*! Child link. See Section 4.1.5.1 */ | ||||
| typedef struct iso_rock_cl_s { | ||||
|   char location[1]; | ||||
| } GNUC_PACKED iso_rock_cl_t ; | ||||
| 
 | ||||
| /*! Parent link. See Section 4.1.5.2 */ | ||||
| typedef struct iso_rock_pl_s { | ||||
|   char location[1]; | ||||
| } GNUC_PACKED iso_rock_pl_t ; | ||||
| 
 | ||||
| /*! These are the bits and their meanings for flags in the TF structure. */ | ||||
| typedef enum { | ||||
|   ISO_ROCK_TF_CREATE     =  1, | ||||
|   ISO_ROCK_TF_MODIFY     =  2, | ||||
|   ISO_ROCK_TF_ACCESS     =  4, | ||||
|   ISO_ROCK_TF_ATTRIBUTES =  8, | ||||
|   ISO_ROCK_TF_BACKUP     =  16, | ||||
|   ISO_ROCK_TF_EXPIRATION =  32, | ||||
|   ISO_ROCK_TF_EFFECTIVE  =  64, | ||||
|   ISO_ROCK_TF_LONG_FORM  = 128 | ||||
| } iso_rock_tf_flag_t; | ||||
| 
 | ||||
| /* These are the bits and their meanings for flags in the TF structure. */ | ||||
| #define ISO_ROCK_TF_CREATE      1 | ||||
| #define ISO_ROCK_TF_MODIFY      2 | ||||
| #define ISO_ROCK_TF_ACCESS      4 | ||||
| #define ISO_ROCK_TF_ATTRIBUTES  8 | ||||
| #define ISO_ROCK_TF_BACKUP     16 | ||||
| #define ISO_ROCK_TF_EXPIRATION 32 | ||||
| #define ISO_ROCK_TF_EFFECTIVE  64 | ||||
| #define ISO_ROCK_TF_LONG_FORM 128 | ||||
| 
 | ||||
| /*! Time stamp(s) for a file. See Rock Ridge Section 4.1.6 */ | ||||
| typedef struct iso_rock_tf_s { | ||||
|   uint8_t flags; /**< See ISO_ROCK_TF_* bits above. */ | ||||
|   uint8_t time_bytes[EMPTY_ARRAY_SIZE]; /**< A homogenious array of
 | ||||
|                                            iso9660_ltime_t or | ||||
|                                            iso9660_dtime_t entries | ||||
|                                            depending on flags & | ||||
|                                            ISO_ROCK_TF_LONG_FORM. Lacking | ||||
|                                            a better method, we store | ||||
|                                            this as an array of bytes | ||||
|                                            and a cast to the | ||||
|                                            appropriate type will have | ||||
|                                            to be made before | ||||
|                                            extraction.  */ | ||||
| } GNUC_PACKED iso_rock_tf_t ; | ||||
| 
 | ||||
| /*! File data in sparse format. See Rock Ridge Section 4.1.7 */ | ||||
| typedef struct iso_rock_sf_s { | ||||
|   iso733_t virtual_size_high; /**< high-order 32 bits of virtual size */ | ||||
|   iso733_t virtual_size_low;  /**< low-order 32 bits of virtual size */ | ||||
|   uint8_t   table_depth; | ||||
| } GNUC_PACKED iso_rock_sf_t ; | ||||
| 
 | ||||
| typedef struct iso_extension_record_s { | ||||
|   char signature[2];   /**< signature word; either 'SP', 'CE', 'ER', 'RR',
 | ||||
|                           'PX', 'PN', 'SL', 'NM', 'CL', 'PL', 'TF', or  | ||||
|                           'ZF' */ | ||||
|   iso711_t len;        /**< length of system-user area - 44 for PX
 | ||||
|                           20 for PN, 5+strlen(text) for SL, 21 for  | ||||
|                           SF, etc. */ | ||||
|   iso711_t version;    /**< version number - value 1 */ | ||||
|   union { | ||||
|     iso_su_sp_t    SP;  /**< system-use-sharing protocol - not
 | ||||
|                           strictly part of Rock Ridge */ | ||||
|     iso_su_er_t    ER;  /**< system-use extension packet - not
 | ||||
|                            strictly part of Rock Ridge */ | ||||
|     iso_su_ce_t    CE;  /**< system-use -  strictly part of Rock Ridge */ | ||||
|     iso_rock_px_t  PX;  /**< Rock Ridge POSIX file attributes */ | ||||
|     iso_rock_pn_t  PN;  /**< Rock Ridge POSIX device number */ | ||||
|     iso_rock_sl_t  SL;  /**< Rock Ridge symbolic link */ | ||||
|     iso_rock_nm_t  NM;  /**< Rock Ridge alternate name */ | ||||
|     iso_rock_cl_t  CL;  /**< Rock Ridge child link */ | ||||
|     iso_rock_pl_t  PL;  /**< Rock Ridge parent link */ | ||||
|     iso_rock_tf_t  TF;  /**< Rock Ridge timestamp(s) for a file */ | ||||
|   } u; | ||||
| } GNUC_PACKED iso_extension_record_t; | ||||
| 
 | ||||
| typedef struct iso_rock_time_s { | ||||
|   bool          b_used;     /**< If true, field has been set and  is valid. 
 | ||||
|                                Otherwise remaning fields are meaningless. */ | ||||
|   bool          b_longdate;  /**< If true date format is a iso9660_ltime_t. 
 | ||||
|                                Otherwise date is iso9660_dtime_t */ | ||||
|   union  | ||||
|   { | ||||
|     iso9660_ltime_t ltime; | ||||
|     iso9660_dtime_t dtime; | ||||
|   } t; | ||||
| } GNUC_PACKED iso_rock_time_t; | ||||
| 
 | ||||
| typedef struct iso_rock_statbuf_s { | ||||
|   bool_3way_t   b3_rock;              /**< has Rock Ridge extension. 
 | ||||
|                                          If "yep", then the fields | ||||
|                                          are used. | ||||
|                                       */ | ||||
|   posix_mode_t  st_mode;              /**< protection */ | ||||
|   posix_nlink_t st_nlinks;            /**< number of hard links */ | ||||
|   posix_uid_t   st_uid;               /**< user ID of owner */ | ||||
|   posix_gid_t   st_gid;               /**< group ID of owner */ | ||||
|   uint8_t       s_rock_offset; | ||||
|   int           i_symlink;            /**< size of psz_symlink */ | ||||
|   int           i_symlink_max;        /**< max allocated to psz_symlink */ | ||||
|   char         *psz_symlink;          /**< if symbolic link, name
 | ||||
|                                          of pointed to file.  */ | ||||
|   iso_rock_time_t create;             /**< create time See ISO 9660:9.5.4. */ | ||||
|   iso_rock_time_t modify;             /**< time of last modification
 | ||||
|                                          ISO 9660:9.5.5. st_mtime field of  | ||||
|                                          POSIX:5.6.1. */ | ||||
|   iso_rock_time_t access;             /**< time of last file access st_atime 
 | ||||
|                                          field of POSIX:5.6.1. */ | ||||
|   iso_rock_time_t attributes;         /**< time of last attribute change.
 | ||||
|                                          st_ctime field of POSIX:5.6.1. */ | ||||
|   iso_rock_time_t backup;             /**< time of last backup. */ | ||||
|   iso_rock_time_t expiration;         /**< time of expiration; See ISO 
 | ||||
|                                          9660:9.5.6. */ | ||||
|   iso_rock_time_t effective;          /**< Effective time; See ISO 9660:9.5.7.
 | ||||
|                                        */ | ||||
|   uint32_t i_rdev;                    /**< the upper 16-bits is major device 
 | ||||
|                                          number, the lower 16-bits is the | ||||
|                                          minor device number */ | ||||
| 
 | ||||
| } iso_rock_statbuf_t; | ||||
|    | ||||
| PRAGMA_END_PACKED | ||||
| 
 | ||||
| /*! return length of name field; 0: not found, -1: to be ignored */ | ||||
| int get_rock_ridge_filename(iso9660_dir_t * de, /*out*/ char * retname,  | ||||
|                             /*out*/ iso9660_stat_t *p_stat); | ||||
| 
 | ||||
|   int parse_rock_ridge_stat(iso9660_dir_t *de, /*out*/ iso9660_stat_t *p_stat); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Returns POSIX mode bitstring for a given file. | ||||
|   */ | ||||
|   mode_t  | ||||
|   iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr); | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns a string which interpreting the POSIX mode st_mode.  | ||||
|   For example: | ||||
|   \verbatim | ||||
|   drwxrws--- | ||||
|   -rw---Sr-- | ||||
|   lrwxrwxrwx | ||||
|   \endverbatim | ||||
|    | ||||
|   A description of the characters in the string follows | ||||
|   The 1st character is either "d" if the entry is a directory, "l" is | ||||
|   a symbolic link or "-" if neither. | ||||
|    | ||||
|   The 2nd to 4th characters refer to permissions for a user while the | ||||
|   the 5th to 7th characters refer to permissions for a group while, and  | ||||
|   the 8th to 10h characters refer to permissions for everyone.  | ||||
|    | ||||
|   In each of these triplets the first character (2, 5, 8) is "r" if | ||||
|   the entry is allowed to be read. | ||||
| 
 | ||||
|   The second character of a triplet (3, 6, 9) is "w" if the entry is | ||||
|   allowed to be written. | ||||
| 
 | ||||
|   The third character of a triplet (4, 7, 10) is "x" if the entry is | ||||
|   executable but not user (for character 4) or group (for characters | ||||
|   6) settable and "s" if the item has the corresponding user/group set. | ||||
| 
 | ||||
|   For a directory having an executable property on ("x" or "s") means | ||||
|   the directory is allowed to be listed or "searched". If the execute | ||||
|   property is not allowed for a group or user but the corresponding | ||||
|   group/user is set "S" indicates this. If none of these properties | ||||
|   holds the "-" indicates this. | ||||
| */ | ||||
| const char *iso9660_get_rock_attr_str(posix_mode_t st_mode); | ||||
| 
 | ||||
| /** These variables are not used, but are defined to facilatate debugging
 | ||||
|     by letting us use enumerations values (which also correspond to  | ||||
|     \#define's inside a debugged program. | ||||
|  */ | ||||
| extern iso_rock_nm_flag_t iso_rock_nm_flag; | ||||
| extern iso_rock_sl_flag_t iso_rock_sl_flag; | ||||
| extern iso_rock_tf_flag_t iso_rock_tf_flag; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __ISO_ROCK_H__ */ | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										286
									
								
								src/libcdio/cdio/sector.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										286
									
								
								src/libcdio/cdio/sector.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,286 @@ | |||
| /*
 | ||||
|     $Id: sector.h,v 1.38 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*!
 | ||||
|    \file sector.h  | ||||
|    \brief Things related to CD-ROM layout: tracks, sector sizes, MSFs, LBAs. | ||||
| 
 | ||||
|   A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, | ||||
|   2340, or 2352 bytes long. | ||||
| 
 | ||||
|   Sector types of the standard CD-ROM data formats: | ||||
| 
 | ||||
| \verbatim  | ||||
|   format   sector type               user data size (bytes) | ||||
|   ----------------------------------------------------------------------------- | ||||
|     1     (Red Book)    CD-DA          2352    (CDIO_CD_FRAMESIZE_RAW) | ||||
|     2     (Yellow Book) Mode1 Form1    2048    (CDIO_CD_FRAMESIZE) | ||||
|     3     (Yellow Book) Mode1 Form2    2336    (M2RAW_SECTOR_SIZE) | ||||
|     4     (Green Book)  Mode2 Form1    2048    (CDIO_CD_FRAMESIZE) | ||||
|     5     (Green Book)  Mode2 Form2    2328    (2324+4 spare bytes) | ||||
|   | ||||
|   | ||||
|         The layout of the standard CD-ROM data formats: | ||||
|   ----------------------------------------------------------------------------- | ||||
|   - audio (red):                  | audio_sample_bytes | | ||||
|                                   |        2352        | | ||||
|   | ||||
|   - data (yellow, mode1):         | sync - head - data - EDC - zero - ECC | | ||||
|                                   |  12  -   4  - 2048 -  4  -   8  - 276 | | ||||
|   | ||||
|   - data (yellow, mode2):         | sync - head - data | | ||||
|                                  |  12  -   4  - 2336 | | ||||
|   | ||||
|   - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | | ||||
|                                   |  12  -   4  -  8  - 2048 -  4  - 276 | | ||||
|   | ||||
|   - XA data (green, mode2 form2): | sync - head - sub - data - Spare | | ||||
|                                   |  12  -   4  -  8  - 2324 -  4    | | ||||
| \endverbatim | ||||
|   | ||||
| 
 | ||||
| */ | ||||
|  | ||||
| #ifndef _CDIO_SECTOR_H_ | ||||
| #define _CDIO_SECTOR_H_ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
|     extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
|       /*! Information that can be obtained through a Read Subchannel
 | ||||
|         command. | ||||
|       */ | ||||
| #define CDIO_SUBCHANNEL_SUBQ_DATA		0 | ||||
| #define CDIO_SUBCHANNEL_CURRENT_POSITION	1 | ||||
| #define CDIO_SUBCHANNEL_MEDIA_CATALOG	        2 | ||||
| #define CDIO_SUBCHANNEL_TRACK_ISRC		3 | ||||
|        | ||||
|       /*! track flags
 | ||||
|        * Q Sub-channel Control Field (4.2.3.3) | ||||
|        */ | ||||
|       typedef enum { | ||||
| 	NONE = 			0x00,	/* no flags set */ | ||||
| 	PRE_EMPHASIS =		0x01,	/* audio track recorded with pre-emphasis */ | ||||
| 	COPY_PERMITTED =	0x02,	/* digital copy permitted */ | ||||
| 	DATA =			0x04,	/* data track */ | ||||
| 	FOUR_CHANNEL_AUDIO =	0x08,	/* 4 audio channels */ | ||||
| 	SCMS =			0x10	/* SCMS (5.29.2.7) */ | ||||
|       } flag_t; | ||||
|        | ||||
| #define CDIO_PREGAP_SECTORS  150 | ||||
| #define CDIO_POSTGAP_SECTORS 150 | ||||
|        | ||||
|       /*! An enumeration for some of the CDIO_CD \#defines below. This isn't
 | ||||
|         really an enumeration one would really use in a program it is to | ||||
|         be helpful in debuggers where wants just to refer to the CDIO_CD_ | ||||
|         names and get something. | ||||
|       */ | ||||
|       extern enum cdio_cd_enums { | ||||
|         CDIO_CD_MINS =              74,   /**< max. minutes per CD, not really
 | ||||
|                                              a limit */ | ||||
|         CDIO_CD_SECS_PER_MIN =      60,   /**< seconds per minute */ | ||||
|         CDIO_CD_FRAMES_PER_SEC =    75,   /**< frames per second */ | ||||
|         CDIO_CD_SYNC_SIZE =         12,   /**< 12 sync bytes per raw data 
 | ||||
|                                              frame */ | ||||
|         CDIO_CD_CHUNK_SIZE =        24,   /**< lowest-level "data bytes 
 | ||||
|                                              piece" */ | ||||
|         CDIO_CD_NUM_OF_CHUNKS =     98,   /**< chunks per frame */ | ||||
|         CDIO_CD_FRAMESIZE_SUB =     96,   /**< subchannel data "frame" size */ | ||||
|         CDIO_CD_HEADER_SIZE =        4,   /**< header (address) bytes per raw
 | ||||
|                                              frame */ | ||||
|         CDIO_CD_SUBHEADER_SIZE =     8,   /**< subheader bytes per raw XA data 
 | ||||
|                                              frame */ | ||||
|         CDIO_CD_ECC_SIZE =         276,   /**< bytes ECC per most raw data 
 | ||||
|                                              frame types */ | ||||
|         CDIO_CD_FRAMESIZE =       2048,   /**< bytes per frame, "cooked" 
 | ||||
|                                              mode */ | ||||
|         CDIO_CD_FRAMESIZE_RAW =   2352,   /**< bytes per frame, "raw" mode */ | ||||
|         CDIO_CD_FRAMESIZE_RAWER = 2646,   /**< The maximum possible 
 | ||||
|                                              returned  */ | ||||
|         CDIO_CD_FRAMESIZE_RAW1  = 2340, | ||||
|         CDIO_CD_FRAMESIZE_RAW0  = 2336, | ||||
|         CDIO_CD_MAX_SESSIONS =      99,  | ||||
|         CDIO_CD_MIN_SESSION_NO =     1,   /**<, Smallest CD session number */ | ||||
|         CDIO_CD_MAX_LSN =       450150,   /**< Largest LSN in a CD */ | ||||
|         CDIO_CD_MIN_LSN      = -450150,   /**< Smallest LSN in a CD */ | ||||
|       } cdio_cd_enums; | ||||
|          | ||||
|       /*!
 | ||||
|         Some generally useful CD-ROM information -- mostly based on the above. | ||||
|         This is from linux.h - not to slight other OS's. This was the first | ||||
|         place I came across such useful stuff. | ||||
|       */ | ||||
| #define CDIO_CD_MINS              74   /**< max. minutes per CD, not really | ||||
|                                           a limit */ | ||||
| #define CDIO_CD_SECS_PER_MIN      60   /**< seconds per minute */ | ||||
| #define CDIO_CD_FRAMES_PER_SEC    75   /**< frames per second */ | ||||
| #define CDIO_CD_SYNC_SIZE         12   /**< 12 sync bytes per raw data frame */ | ||||
| #define CDIO_CD_CHUNK_SIZE        24   /**< lowest-level "data bytes piece" */ | ||||
| #define CDIO_CD_NUM_OF_CHUNKS     98   /**< chunks per frame */ | ||||
| #define CDIO_CD_FRAMESIZE_SUB     96   /**< subchannel data "frame" size */ | ||||
| #define CDIO_CD_HEADER_SIZE        4   /**< header (address) bytes per raw | ||||
|                                           data frame */ | ||||
| #define CDIO_CD_SUBHEADER_SIZE     8   /**< subheader bytes per raw XA data  | ||||
|                                             frame */ | ||||
| #define CDIO_CD_EDC_SIZE           4   /**< bytes EDC per most raw data | ||||
|                                           frame types */ | ||||
| #define CDIO_CD_M1F1_ZERO_SIZE     8   /**< bytes zero per yellow book mode | ||||
|                                           1 frame */ | ||||
| #define CDIO_CD_ECC_SIZE         276   /**< bytes ECC per most raw data frame  | ||||
|                                           types */ | ||||
| #define CDIO_CD_FRAMESIZE       2048   /**< bytes per frame, "cooked" mode */ | ||||
| #define CDIO_CD_FRAMESIZE_RAW   2352   /**< bytes per frame, "raw" mode */ | ||||
| #define CDIO_CD_FRAMESIZE_RAWER 2646   /**< The maximum possible returned  | ||||
|                                           bytes */  | ||||
| #define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ | ||||
| #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/ | ||||
|        | ||||
|       /*! "before data" part of raw XA (green, mode2) frame */ | ||||
| #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE)  | ||||
|        | ||||
|       /*! "after data" part of raw XA (green, mode2 form1) frame */ | ||||
| #define CDIO_CD_XA_TAIL   (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE)  | ||||
|        | ||||
|       /*! "before data" sync bytes + header of XA (green, mode2) frame */ | ||||
| #define CDIO_CD_XA_SYNC_HEADER   (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER)  | ||||
|        | ||||
|       /*! String of bytes used to identify the beginning of a Mode 1 or
 | ||||
|           Mode 2 sector. */ | ||||
|       extern const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE]; | ||||
|       /**<  
 | ||||
|         {0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}; | ||||
|       */ | ||||
|        | ||||
|       /*! An enumeration for some of the M2*_SECTOR_SIZE \#defines
 | ||||
|         below. This isn't really an enumeration one would really use in a | ||||
|         program it is to be helpful in debuggers where wants just to refer | ||||
|         to the M2*_SECTOR_SIZE names and get something. | ||||
|       */ | ||||
|       extern enum m2_sector_enums { | ||||
|         M2F2_SECTOR_SIZE  = 2324, | ||||
|         M2SUB_SECTOR_SIZE = 2332, | ||||
|         M2RAW_SECTOR_SIZE = 2336 | ||||
|       } m2_sector_enums; | ||||
|        | ||||
| #define M2F2_SECTOR_SIZE    2324 | ||||
| #define M2SUB_SECTOR_SIZE   2332 | ||||
| #define M2RAW_SECTOR_SIZE   2336 | ||||
|        | ||||
|       /*! Largest CD session number */ | ||||
| #define CDIO_CD_MAX_SESSIONS    99  | ||||
|       /*! Smallest CD session number */ | ||||
| #define CDIO_CD_MIN_SESSION_NO   1 | ||||
|        | ||||
|       /*! Largest LSN in a CD */ | ||||
| #define CDIO_CD_MAX_LSN   450150 | ||||
|       /*! Smallest LSN in a CD */ | ||||
| #define CDIO_CD_MIN_LSN  -450150 | ||||
|        | ||||
|        | ||||
| #define CDIO_CD_FRAMES_PER_MIN                          \ | ||||
|       (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN) | ||||
|        | ||||
| #define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN) | ||||
| #define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN) | ||||
| #define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN) | ||||
|        | ||||
| #define CDIO_CD_MAX_SECTORS                                     \ | ||||
|       (UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS) | ||||
|        | ||||
| #define msf_t_SIZEOF 3 | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an LBA into a string representation of the MSF. | ||||
|         \warning cdio_lba_to_msf_str returns new allocated string */ | ||||
|       char *cdio_lba_to_msf_str (lba_t i_lba); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an MSF into a string representation of the MSF. | ||||
|         \warning cdio_msf_to_msf_str returns new allocated string */ | ||||
|       char *cdio_msf_to_str (const msf_t *p_msf); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an LBA into the corresponding LSN. | ||||
|       */ | ||||
|       lba_t cdio_lba_to_lsn (lba_t i_lba); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an LBA into the corresponding MSF. | ||||
|       */ | ||||
|       void  cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an LSN into the corresponding LBA. | ||||
|         CDIO_INVALID_LBA is returned if there is an error. | ||||
|       */ | ||||
|       lba_t cdio_lsn_to_lba (lsn_t i_lsn); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert an LSN into the corresponding MSF. | ||||
|       */ | ||||
|       void  cdio_lsn_to_msf (lsn_t i_lsn, msf_t *p_msf); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert a MSF into the corresponding LBA. | ||||
|         CDIO_INVALID_LBA is returned if there is an error. | ||||
|       */ | ||||
|       lba_t cdio_msf_to_lba (const msf_t *p_msf); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert a MSF into the corresponding LSN. | ||||
|         CDIO_INVALID_LSN is returned if there is an error. | ||||
|       */ | ||||
|       lsn_t cdio_msf_to_lsn (const msf_t *p_msf); | ||||
|        | ||||
|       /*!  
 | ||||
|         Convert a MSF - broken out as 3 integer components into the | ||||
|         corresponding LBA.   | ||||
|         CDIO_INVALID_LBA is returned if there is an error. | ||||
|       */ | ||||
|       lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds,  | ||||
|                               unsigned int frames); | ||||
|        | ||||
|       /*! 
 | ||||
|         Convert a string of the form MM:SS:FF into the corresponding LBA. | ||||
|         CDIO_INVALID_LBA is returned if there is an error. | ||||
|       */ | ||||
|       lba_t cdio_mmssff_to_lba (const char *psz_mmssff); | ||||
|        | ||||
| #ifdef __cplusplus | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
| #ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY | ||||
| /** For compatibility with good ol' paranoia */ | ||||
| #define CD_FRAMESIZE_RAW        CDIO_CD_FRAMESIZE_RAW | ||||
| #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ | ||||
| 
 | ||||
| #endif /* _CDIO_SECTOR_H_ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										256
									
								
								src/libcdio/cdio/track.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										256
									
								
								src/libcdio/cdio/track.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,256 @@ | |||
| /*
 | ||||
|     $Id: track.h,v 1.14 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file track.h 
 | ||||
|  *  \brief  The top-level header for track-related libcdio calls. | ||||
|  */ | ||||
| #ifndef __CDIO_TRACK_H__ | ||||
| #define __CDIO_TRACK_H__ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*! Printable tags for track_format_t enumeration.  */ | ||||
|   extern const char *track_format2str[6]; | ||||
|    | ||||
|   typedef enum  { | ||||
|     TRACK_FORMAT_AUDIO,   /**< Audio track, e.g. CD-DA */ | ||||
|     TRACK_FORMAT_CDI,     /**< CD-i. How this is different from DATA below? */ | ||||
|     TRACK_FORMAT_XA,      /**< Mode2 of some sort */ | ||||
|     TRACK_FORMAT_DATA,    /**< Mode1 of some sort */ | ||||
|     TRACK_FORMAT_PSX,     /**< Playstation CD. Like audio but only 2336 bytes
 | ||||
| 			   *   of user data. | ||||
| 			   */ | ||||
|     TRACK_FORMAT_ERROR    /**< Dunno what is, or some other error. */ | ||||
|   } track_format_t; | ||||
| 
 | ||||
|   typedef enum { | ||||
|     CDIO_TRACK_FLAG_FALSE,  | ||||
|     CDIO_TRACK_FLAG_TRUE,  | ||||
|     CDIO_TRACK_FLAG_ERROR,  | ||||
|     CDIO_TRACK_FLAG_UNKNOWN | ||||
|   } track_flag_t; | ||||
| 
 | ||||
|   /*! \brief Structure containing attributes associated with a track */ | ||||
|   typedef struct { | ||||
|     track_flag_t preemphasis; /**< Linear preemphasis on an audio track */ | ||||
|     track_flag_t copy_permit; /**< Whether copying is permitted */ | ||||
|     int channels;             /**< Number of audio channels, 2, 4. -2 if not
 | ||||
| 				   implemented or -1 for error. | ||||
| 			      */ | ||||
|   } track_flags_t; | ||||
|      | ||||
|   /*! The leadout track is always 0xAA, regardless of # of tracks on
 | ||||
|     disc, or what value may be used internally. For example although | ||||
|     OS X uses a different value for the lead-out track internally than | ||||
|     given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and | ||||
|     not worry about this. | ||||
|   */ | ||||
| 
 | ||||
|   /*! An enumeration for some of the CDIO_CDROM_* \#defines below. This
 | ||||
|     isn't really an enumeration one would really use in a program; it | ||||
|     is to be helpful in debuggers where wants just to refer to the | ||||
|     CDIO_CDROM_* names and get something. | ||||
|   */ | ||||
|   extern enum cdio_track_enums { | ||||
|     CDIO_CDROM_LBA           = 0x01, /**< "logical block": first frame is #0 */ | ||||
|     CDIO_CDROM_MSF           = 0x02, /**< "minute-second-frame": binary, not
 | ||||
| 					BCD here! */ | ||||
|     CDIO_CDROM_DATA_TRACK    = 0x04,  | ||||
|     CDIO_CDROM_CDI_TRACK     = 0x10, | ||||
|     CDIO_CDROM_XA_TRACK      = 0x20, | ||||
|     CDIO_CD_MAX_TRACKS       =   99, /**< Largest CD track number */ | ||||
|     CDIO_CDROM_LEADOUT_TRACK = 0xAA, /**< Lead-out track number */ | ||||
|     CDIO_INVALID_TRACK       = 0xFF, /**<  Constant for invalid track number */ | ||||
| 
 | ||||
|    } cdio_track_enums; | ||||
|    | ||||
| #define CDIO_CD_MIN_TRACK_NO  1 /**< Smallest CD track number */ | ||||
|    | ||||
|   /*! track modes (Table 350) 
 | ||||
|     reference: MMC-3 draft revsion - 10g | ||||
|   */ | ||||
|   typedef enum { | ||||
|     AUDIO,			/**< 2352 byte block length */ | ||||
|     MODE1,			/**< 2048 byte block length */ | ||||
|     MODE1_RAW,			/**< 2352 byte block length */ | ||||
|     MODE2,			/**< 2336 byte block length */ | ||||
|     MODE2_FORM1,		/**< 2048 byte block length */ | ||||
|     MODE2_FORM2,		/**< 2324 byte block length */ | ||||
|     MODE2_FORM_MIX,		/**< 2336 byte block length */ | ||||
|     MODE2_RAW			/**< 2352 byte block length */ | ||||
|   } trackmode_t; | ||||
|    | ||||
|   /*!
 | ||||
|     Get the number of the first track.  | ||||
| 
 | ||||
|     @return the track number or CDIO_INVALID_TRACK  | ||||
|     on error. | ||||
|   */ | ||||
|   track_t cdio_get_first_track_num(const CdIo_t *p_cdio); | ||||
|    | ||||
|   /*!
 | ||||
|     Return the last track number. | ||||
|     CDIO_INVALID_TRACK is returned on error. | ||||
|   */ | ||||
|   track_t cdio_get_last_track_num (const CdIo_t *p_cdio); | ||||
|    | ||||
| 
 | ||||
|   /*! Find the track which contains lsn.
 | ||||
|     CDIO_INVALID_TRACK is returned if the lsn outside of the CD or | ||||
|     if there was some error.  | ||||
|      | ||||
|     If the lsn is before the pregap of the first track 0 is returned. | ||||
|     Otherwise we return the track that spans the lsn. | ||||
|   */ | ||||
|   track_t cdio_get_track(const CdIo_t *p_cdio, lsn_t lsn); | ||||
| 
 | ||||
|   /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|       implemented or -1 for error. | ||||
|       Not meaningful if track is not an audio track. | ||||
|   */ | ||||
|   int cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*! Return copy protection status on a track. Is this meaningful
 | ||||
|       if not an audio track? | ||||
|    */ | ||||
|   track_flag_t cdio_get_track_copy_permit(const CdIo_t *p_cdio,  | ||||
| 					  track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Get the format (audio, mode2, mode1) of track.  | ||||
|   */ | ||||
|   track_format_t cdio_get_track_format(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!
 | ||||
|     Return true if we have XA data (green, mode2 form1) or | ||||
|     XA data (green, mode2 form2). That is track begins: | ||||
|     sync - header - subheader | ||||
|     12     4      -  8 | ||||
|      | ||||
|     FIXME: there's gotta be a better design for this and get_track_format? | ||||
|   */ | ||||
|   bool cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track); | ||||
|      | ||||
|   /*!  
 | ||||
|     Return the ending LSN for track number | ||||
|     i_track in cdio.  CDIO_INVALID_LSN is returned on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_last_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Get the starting LBA for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LBA or CDIO_INVALID_LBA on error. | ||||
|   */ | ||||
|   lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Return the starting LSN for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LSN or CDIO_INVALID_LSN on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return the starting LBA for the pregap for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LBA for | ||||
|     @return the starting LBA or CDIO_INVALID_LBA on error. | ||||
|   */ | ||||
|   lba_t cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return the starting LSN for the pregap for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LSN or CDIO_INVALID_LSN on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_pregap_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get the International Standard Recording Code (ISRC) for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @return the International Standard Recording Code (ISRC) or NULL | ||||
|     if there is none or we don't have the ability to get it. | ||||
| 
 | ||||
|     Note: string is malloc'd so caller has to free() the returned | ||||
|     string when done with it. | ||||
| 
 | ||||
|   */ | ||||
|   char * cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Return the starting MSF (minutes/secs/frames) for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
|      | ||||
|     @return true if things worked or false if there is no track entry. | ||||
|   */ | ||||
|   bool cdio_get_track_msf(const CdIo_t *p_cdio, track_t i_track,  | ||||
| 			  /*out*/ msf_t *msf); | ||||
|    | ||||
|   /*! Get linear preemphasis status on an audio track 
 | ||||
|       This is not meaningful if not an audio track? | ||||
|    */ | ||||
|   track_flag_t cdio_get_track_preemphasis(const CdIo_t *p_cdio, | ||||
| 					  track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Get the number of sectors between this track an the next.  This | ||||
|     includes any pregap sectors before the start of the next track. | ||||
|     Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @return the number of sectors or 0 if there is an error. | ||||
|   */ | ||||
|   unsigned int cdio_get_track_sec_count(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_TRACK_H__ */ | ||||
| 
 | ||||
							
								
								
									
										336
									
								
								src/libcdio/cdio/types.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										336
									
								
								src/libcdio/cdio/types.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,336 @@ | |||
| /*
 | ||||
|     Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 | ||||
|                   Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file types.h 
 | ||||
|  *  \brief  Common type definitions used pervasively in libcdio. | ||||
|  */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_TYPES_H__ | ||||
| #define __CDIO_TYPES_H__ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /* If <sys/types.h> is not available on your platform please
 | ||||
|    contact the libcdio mailing list so that we can fix it! */ | ||||
| #if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES)  | ||||
| #include <sys/types.h> | ||||
| #endif  | ||||
| 
 | ||||
| #if defined(AMIGA) | ||||
| typedef u_int8_t uint8_t; | ||||
| typedef u_int16_t uint16_t; | ||||
| typedef u_int32_t uint32_t; | ||||
| typedef u_int64_t uint64_t; | ||||
| #else | ||||
| /* If <stdint.h> is not available on your platform please
 | ||||
|    contact the libcdio mailing list so that we can fix it! | ||||
|    For MSVC, you can find both a public domain stdint.h and | ||||
|    inttypes.h in the MSVC/missing directory of libcdio. */ | ||||
| #include <stdint.h> | ||||
| #endif | ||||
| 
 | ||||
| typedef uint8_t ubyte; | ||||
| 
 | ||||
| /* MSVC does not define mode_t and ssize_t by default. The way
 | ||||
|    to compensate for missing UNIX types is to include a custom | ||||
|    unistd.h that defines them. Such a file is provided with | ||||
|    the libcdio source, in the MSVC/missing directory */ | ||||
| #if defined(_MSC_VER) | ||||
| #include <unistd.h> | ||||
| #endif | ||||
| 
 | ||||
|   /* default HP/UX macros are broken */ | ||||
| #if defined(__hpux__) | ||||
| # undef UINT16_C | ||||
| # undef UINT32_C | ||||
| # undef UINT64_C | ||||
| # undef INT64_C | ||||
| #endif | ||||
| 
 | ||||
|   /* if it's still not defined, take a good guess... should work for
 | ||||
|      most 32bit and 64bit archs */ | ||||
|    | ||||
| #ifndef UINT16_C | ||||
| # define UINT16_C(c) c ## U | ||||
| #endif | ||||
|    | ||||
| #ifndef UINT32_C | ||||
| # if defined (SIZEOF_INT) && SIZEOF_INT == 4 | ||||
| #  define UINT32_C(c) c ## U | ||||
| # elif defined (SIZEOF_LONG) && SIZEOF_LONG == 4 | ||||
| #  define UINT32_C(c) c ## UL | ||||
| # else | ||||
| #  define UINT32_C(c) c ## U | ||||
| # endif | ||||
| #endif | ||||
|    | ||||
| #ifndef UINT64_C | ||||
| # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8 | ||||
| #  define UINT64_C(c) c ## UL | ||||
| # elif defined (SIZEOF_INT) && SIZEOF_INT == 8 | ||||
| #  define UINT64_C(c) c ## U | ||||
| # else | ||||
| #  define UINT64_C(c) c ## ULL | ||||
| # endif | ||||
| #endif | ||||
|    | ||||
| #ifndef INT64_C | ||||
| # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8 | ||||
| #  define INT64_C(c) c ## L | ||||
| # elif defined (SIZEOF_INT) && SIZEOF_INT == 8 | ||||
| #  define INT64_C(c) c  | ||||
| # else | ||||
| #  define INT64_C(c) c ## LL | ||||
| # endif | ||||
| #endif | ||||
|    | ||||
| #ifndef __cplusplus | ||||
| 
 | ||||
| /* All the stdbool.h seem to define those */ | ||||
| #ifndef __bool_true_false_are_defined | ||||
| #define __bool_true_false_are_defined 1 | ||||
| 
 | ||||
| #undef bool | ||||
| #undef true | ||||
| #undef false | ||||
| 
 | ||||
| #ifdef _Bool | ||||
| #define bool _Bool | ||||
| #else | ||||
| #define bool int | ||||
| #endif | ||||
| #define true 1 | ||||
| #define false 0 | ||||
| 
 | ||||
| #endif /* __bool_true_false_are_defined */ | ||||
| #endif /*C++*/ | ||||
|    | ||||
|   /* some GCC optimizations -- gcc 2.5+ */ | ||||
|    | ||||
| #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) | ||||
| #define GNUC_PRINTF( format_idx, arg_idx )              \ | ||||
|   __attribute__((format (printf, format_idx, arg_idx))) | ||||
| #define GNUC_SCANF( format_idx, arg_idx )               \ | ||||
|   __attribute__((format (scanf, format_idx, arg_idx))) | ||||
| #define GNUC_FORMAT( arg_idx )                  \ | ||||
|   __attribute__((format_arg (arg_idx))) | ||||
| #define GNUC_NORETURN                           \ | ||||
|   __attribute__((noreturn)) | ||||
| #define GNUC_CONST                              \ | ||||
|   __attribute__((const)) | ||||
| #define GNUC_UNUSED                             \ | ||||
|   __attribute__((unused)) | ||||
| #define GNUC_PACKED                             \ | ||||
|   __attribute__((packed)) | ||||
| #else   /* !__GNUC__ */ | ||||
| #define GNUC_PRINTF( format_idx, arg_idx ) | ||||
| #define GNUC_SCANF( format_idx, arg_idx ) | ||||
| #define GNUC_FORMAT( arg_idx ) | ||||
| #define GNUC_NORETURN | ||||
| #define GNUC_CONST | ||||
| #define GNUC_UNUSED | ||||
| #define GNUC_PACKED | ||||
| #endif  /* !__GNUC__ */ | ||||
|    | ||||
| #if defined(__GNUC__) | ||||
|   /* for GCC we try to use GNUC_PACKED */ | ||||
| # define PRAGMA_BEGIN_PACKED | ||||
| # define PRAGMA_END_PACKED | ||||
| #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) | ||||
|   /* should work with most EDG-frontend based compilers */ | ||||
| # define PRAGMA_BEGIN_PACKED _Pragma("pack(1)") | ||||
| # define PRAGMA_END_PACKED   _Pragma("pack()") | ||||
| #elif defined(_MSC_VER) | ||||
| # define PRAGMA_BEGIN_PACKED __pragma(pack(push, 1)) | ||||
| # define PRAGMA_END_PACKED   __pragma(pack(pop)) | ||||
| #else /* neither gcc nor _Pragma() available... */ | ||||
|   /* ...so let's be naive and hope the regression testsuite is run... */ | ||||
| # define PRAGMA_BEGIN_PACKED | ||||
| # define PRAGMA_END_PACKED | ||||
| #endif | ||||
|    | ||||
|   /*
 | ||||
|    * user directed static branch prediction gcc 2.96+ | ||||
|    */ | ||||
| #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95) | ||||
| # define GNUC_LIKELY(x)   __builtin_expect((x),true) | ||||
| # define GNUC_UNLIKELY(x) __builtin_expect((x),false) | ||||
| #else  | ||||
| # define GNUC_LIKELY(x)   (x)  | ||||
| # define GNUC_UNLIKELY(x) (x) | ||||
| #endif | ||||
|    | ||||
| #ifndef NULL | ||||
| # define NULL ((void*) 0) | ||||
| #endif | ||||
|    | ||||
|   /* our own offsetof()-like macro */ | ||||
| #define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||||
|    | ||||
|   /*!
 | ||||
|     \brief MSF (minute/second/frame) structure  | ||||
| 
 | ||||
|     One CD-ROMs addressing scheme especially used in audio formats | ||||
|     (Red Book) is an address by minute, sector and frame which | ||||
|     BCD-encoded in three bytes. An alternative format is an lba_t. | ||||
| 
 | ||||
|     Note: the fields in this structure are BCD encoded. Use | ||||
|     cdio_to_bcd8() or cdio_from_bcd8() to convert an integer into or | ||||
|     out of this format. The format specifier %x (not %d) can be used | ||||
|     if you need to format or print values in this structure. | ||||
|      | ||||
|     @see lba_t | ||||
|   */ | ||||
|   PRAGMA_BEGIN_PACKED | ||||
|   struct msf_s { | ||||
|     uint8_t m, s, f; /* BCD encoded! */ | ||||
|   } GNUC_PACKED; | ||||
|   PRAGMA_END_PACKED | ||||
|    | ||||
|   typedef struct msf_s msf_t; | ||||
| 
 | ||||
| #define msf_t_SIZEOF 3 | ||||
| 
 | ||||
|   /*!
 | ||||
|     \brief UTF-8 char definition  | ||||
| 
 | ||||
|     Type to denote UTF-8 strings. | ||||
|   */ | ||||
| 
 | ||||
|   typedef char cdio_utf8_t; | ||||
| 
 | ||||
|   typedef enum  { | ||||
|     nope  = 0, | ||||
|     yep   = 1, | ||||
|     dunno = 2 | ||||
|   } bool_3way_t; | ||||
|    | ||||
|   /* type used for bit-fields in structs (1 <= bits <= 8) */ | ||||
| #if defined(__GNUC__) | ||||
|   /* this is strict ISO C99 which allows only 'unsigned int', 'signed
 | ||||
|      int' and '_Bool' explicitly as bit-field type */ | ||||
|   typedef unsigned int bitfield_t; | ||||
| #else | ||||
|   /* other compilers might increase alignment requirements to match the
 | ||||
|      'unsigned int' type -- fixme: find out how unalignment accesses can | ||||
|      be pragma'ed on non-gcc compilers */ | ||||
|   typedef uint8_t bitfield_t; | ||||
| #endif | ||||
|    | ||||
|   /*! The type of a Logical Block Address. We allow for an lba to be 
 | ||||
|     negative to be consistent with an lba, although I'm not sure this | ||||
|     this is possible. | ||||
|        | ||||
|    */ | ||||
|   typedef int32_t lba_t; | ||||
|    | ||||
|   /*! The type of a Logical Sector Number. Note that an lba can be negative
 | ||||
|     and the MMC3 specs allow for a conversion of a negative lba. | ||||
| 
 | ||||
|     @see msf_t | ||||
|   */ | ||||
|   typedef int32_t lsn_t; | ||||
|    | ||||
|   /* Address in either MSF or logical format */ | ||||
|   union cdio_cdrom_addr		 | ||||
|   { | ||||
|     msf_t	msf; | ||||
|     lba_t	lba; | ||||
|   }; | ||||
| 
 | ||||
|   /*! The type of a track number 0..99. */ | ||||
|   typedef uint8_t track_t; | ||||
|    | ||||
|   /*! The type of a session number 0..99. */ | ||||
|   typedef uint8_t session_t; | ||||
|    | ||||
|   /*! 
 | ||||
|     Constant for invalid session number | ||||
|   */ | ||||
| #define CDIO_INVALID_SESSION   0xFF | ||||
|    | ||||
|   /*! 
 | ||||
|     Constant for invalid LBA. It is 151 less than the most negative | ||||
|     LBA -45150. This provide slack for the 150-frame offset in | ||||
|     LBA to LSN 150 conversions | ||||
|   */ | ||||
| #define CDIO_INVALID_LBA    -45301 | ||||
|    | ||||
|   /*! 
 | ||||
|     Constant for invalid LSN | ||||
|   */ | ||||
| #define CDIO_INVALID_LSN    CDIO_INVALID_LBA | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Number of ASCII bytes in a media catalog number (MCN). | ||||
|     We include an extra 0 byte so these can be used as C strings. | ||||
|   */ | ||||
| #define CDIO_MCN_SIZE       13 | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Type to hold ASCII bytes in a media catalog number (MCN). | ||||
|     We include an extra 0 byte so these can be used as C strings. | ||||
|   */ | ||||
|   typedef char cdio_mcn_t[CDIO_MCN_SIZE+1]; | ||||
|    | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Number of ASCII bytes in International Standard Recording Codes (ISRC) | ||||
|   */ | ||||
| #define CDIO_ISRC_SIZE       12 | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Type to hold ASCII bytes in a ISRC. | ||||
|     We include an extra 0 byte so these can be used as C strings. | ||||
|   */ | ||||
|   typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1]; | ||||
| 
 | ||||
|   typedef int cdio_fs_anal_t; | ||||
| 
 | ||||
|   /*! 
 | ||||
|     track flags | ||||
|     Q Sub-channel Control Field (4.2.3.3) | ||||
|   */ | ||||
|   typedef enum { | ||||
|     CDIO_TRACK_FLAG_NONE = 		 0x00,	/**< no flags set */ | ||||
|     CDIO_TRACK_FLAG_PRE_EMPHASIS =	 0x01,	/**< audio track recorded with
 | ||||
|                                                    pre-emphasis */ | ||||
|     CDIO_TRACK_FLAG_COPY_PERMITTED =	 0x02,	/**< digital copy permitted */ | ||||
|     CDIO_TRACK_FLAG_DATA =		 0x04,	/**< data track */ | ||||
|     CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08,  /**< 4 audio channels */ | ||||
|   CDIO_TRACK_FLAG_SCMS =		 0x10	/**< SCMS (5.29.2.7) */ | ||||
| } cdio_track_flag; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_TYPES_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										190
									
								
								src/libcdio/cdio/udf.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								src/libcdio/cdio/udf.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,190 @@ | |||
| /*  
 | ||||
|     Copyright (C) 2005, 2006, 2008, 2010 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /*!
 | ||||
|  * \file udf.h  | ||||
|  * | ||||
|  * \brief The top-level interface header for libudf: UDF filesystem | ||||
|  * library; applications include this. | ||||
|  * | ||||
| */ | ||||
| 
 | ||||
| #ifndef UDF_H | ||||
| #define UDF_H  | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/ecma_167.h> | ||||
| #include <cdio/posix.h> | ||||
| 
 | ||||
| typedef uint16_t partition_num_t; | ||||
| 
 | ||||
| /** Opaque structures. */ | ||||
| typedef struct udf_s udf_t;  | ||||
| typedef struct udf_file_s udf_file_t; | ||||
| 
 | ||||
| typedef struct udf_dirent_s { | ||||
|     char              *psz_name; | ||||
|     bool               b_dir;    /* true if this entry is a directory. */ | ||||
|     bool               b_parent; /* True if has parent directory (e.g. not root
 | ||||
|                                     directory). If not set b_dir will probably | ||||
|                                     be true. */ | ||||
|     udf_t             *p_udf; | ||||
|     uint32_t           i_part_start; | ||||
|     uint32_t           i_loc, i_loc_end; | ||||
|     uint64_t           dir_left; | ||||
|     uint8_t           *sector; | ||||
|     udf_fileid_desc_t *fid; | ||||
|      | ||||
|     /* This field has to come last because it is variable in length. */ | ||||
|     udf_file_entry_t   fe; | ||||
| } udf_dirent_t; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /**
 | ||||
|    Imagine the below a \#define'd value rather than distinct values of | ||||
|    an enum. | ||||
| */ | ||||
| typedef enum { | ||||
|   UDF_BLOCKSIZE       = 2048 | ||||
| } udf_enum1_t;  | ||||
| 
 | ||||
| /** This variable is trickery to force the above enum symbol value to
 | ||||
|     be recorded in debug symbol tables. It is used to allow one refer | ||||
|     to above enumeration values in a debugger and debugger | ||||
|     expressions */ | ||||
| extern udf_enum1_t debug_udf_enum1; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*!
 | ||||
|     Close UDF and free resources associated with p_udf. | ||||
|   */ | ||||
|   bool udf_close (udf_t *p_udf); | ||||
|    | ||||
|   /*!  
 | ||||
|     Seek to a position i_start and then read i_blocks. Number of | ||||
|     blocks read is returned. One normally expects the return to be | ||||
|     equal to i_blocks. | ||||
|   */ | ||||
| 
 | ||||
|   driver_return_code_t udf_read_sectors (const udf_t *p_udf, void *ptr,  | ||||
|                                          lsn_t i_start,  long int i_blocks); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Open an UDF for reading. Maybe in the future we will have | ||||
|     a mode. NULL is returned on error. | ||||
|      | ||||
|     Caller must free result - use udf_close for that. | ||||
|   */ | ||||
|   udf_t *udf_open (const char *psz_path); | ||||
|    | ||||
|   /*!
 | ||||
|     Return the partition number of the the opened udf handle. -1  | ||||
|     Is returned if we have an error. | ||||
|   */ | ||||
|   int16_t udf_get_part_number(const udf_t *p_udf); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get the root in p_udf. If b_any_partition is false then | ||||
|     the root must be in the given partition. | ||||
|     NULL is returned if the partition is not found or a root is not found or | ||||
|     there is on error. | ||||
| 
 | ||||
|     Caller must free result - use udf_file_free for that. | ||||
|   */ | ||||
|   udf_dirent_t *udf_get_root (udf_t *p_udf, bool b_any_partition,  | ||||
|                               partition_num_t i_partition); | ||||
|    | ||||
|   /**
 | ||||
|    * Gets the Volume Identifier string, in 8bit unicode (latin-1) | ||||
|    * psz_volid, place to put the string | ||||
|    * i_volid_size, size of the buffer volid points to | ||||
|    * returns the size of buffer needed for all data | ||||
|    */ | ||||
|   int udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,   | ||||
|                         unsigned int i_volid); | ||||
|    | ||||
|   /**
 | ||||
|    * Gets the Volume Set Identifier, as a 128-byte dstring (not decoded) | ||||
|    * WARNING This is not a null terminated string | ||||
|    * volsetid, place to put the data | ||||
|    * volsetid_size, size of the buffer volsetid points to  | ||||
|    * the buffer should be >=128 bytes to store the whole volumesetidentifier | ||||
|    * returns the size of the available volsetid information (128) | ||||
|    * or 0 on error | ||||
|    */ | ||||
|   int udf_get_volumeset_id(udf_t *p_udf, /*out*/ uint8_t *volsetid, | ||||
|                            unsigned int i_volsetid); | ||||
|    | ||||
|   /*!
 | ||||
|     Return a file pointer matching psz_name.  | ||||
|   */ | ||||
|   udf_dirent_t *udf_fopen(udf_dirent_t *p_udf_root, const char *psz_name); | ||||
|    | ||||
|   /*! udf_mode_string - fill in string PSZ_STR with an ls-style ASCII
 | ||||
|     representation of the i_mode. PSZ_STR is returned. | ||||
| 
 | ||||
|     10 characters are stored in PSZ_STR; a terminating null byte is added. | ||||
|     The characters stored in PSZ_STR are: | ||||
|      | ||||
|     0   File type.  'd' for directory, 'c' for character | ||||
|         special, 'b' for block special, 'm' for multiplex, | ||||
|         'l' for symbolic link, 's' for socket, 'p' for fifo, | ||||
|         '-' for regular, '?' for any other file type | ||||
| 
 | ||||
|     1   'r' if the owner may read, '-' otherwise. | ||||
| 
 | ||||
|     2   'w' if the owner may write, '-' otherwise. | ||||
| 
 | ||||
|     3   'x' if the owner may execute, 's' if the file is | ||||
|         set-user-id, '-' otherwise. | ||||
|         'S' if the file is set-user-id, but the execute | ||||
|         bit isn't set. | ||||
| 
 | ||||
|     4   'r' if group members may read, '-' otherwise. | ||||
| 
 | ||||
|     5   'w' if group members may write, '-' otherwise. | ||||
| 
 | ||||
|     6   'x' if group members may execute, 's' if the file is | ||||
|         set-group-id, '-' otherwise. | ||||
|         'S' if it is set-group-id but not executable. | ||||
| 
 | ||||
|     7   'r' if any user may read, '-' otherwise. | ||||
| 
 | ||||
|     8   'w' if any user may write, '-' otherwise. | ||||
| 
 | ||||
|     9   'x' if any user may execute, 't' if the file is "sticky" | ||||
|         (will be retained in swap space after execution), '-' | ||||
|         otherwise. | ||||
|         'T' if the file is sticky but not executable.  */ | ||||
| 
 | ||||
|     char *udf_mode_string (mode_t i_mode, char *psz_str); | ||||
| 
 | ||||
|     bool udf_get_lba(const udf_file_entry_t *p_udf_fe,  | ||||
|                      /*out*/ uint32_t *start, /*out*/ uint32_t *end); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #include <cdio/udf_time.h> | ||||
| #include <cdio/udf_file.h> | ||||
| 
 | ||||
| #endif /*UDF_H*/ | ||||
							
								
								
									
										115
									
								
								src/libcdio/cdio/udf_file.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								src/libcdio/cdio/udf_file.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,115 @@ | |||
| /*  
 | ||||
|     Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|  * \file udf_file.h  | ||||
|  * | ||||
|  * \brief Routines involving UDF file operations | ||||
|  * | ||||
| */ | ||||
| 
 | ||||
| #ifndef UDF_FILE_H | ||||
| #define UDF_FILE_H  | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /**
 | ||||
|     Return the file id descriptor of the given file. | ||||
|   */ | ||||
|   bool udf_get_fileid_descriptor(const udf_dirent_t *p_udf_dirent,  | ||||
| 				 /*out*/ udf_fileid_desc_t *p_udf_fid); | ||||
| 
 | ||||
|   /**
 | ||||
|     Return the name of the file | ||||
|   */ | ||||
|   const char *udf_get_filename(const udf_dirent_t *p_udf_dirent); | ||||
|    | ||||
|   /**
 | ||||
|     Return the name of the file | ||||
|   */ | ||||
|   bool udf_get_file_entry(const udf_dirent_t *p_udf_dirent,  | ||||
| 			  /*out*/ udf_file_entry_t *p_udf_fe); | ||||
| 
 | ||||
|   /**
 | ||||
|     Return the number of hard links of the file. Return 0 if error. | ||||
|   */ | ||||
|   uint16_t udf_get_link_count(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /**
 | ||||
|     Return the file length the file. Return 2147483647L if error. | ||||
|   */ | ||||
|   uint64_t udf_get_file_length(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /**  
 | ||||
|     Returns a POSIX mode for a given p_udf_dirent. | ||||
|   */ | ||||
|   mode_t udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /**
 | ||||
|     Return the next subdirectory.  | ||||
|   */ | ||||
|   udf_dirent_t *udf_opendir(const udf_dirent_t *p_udf_dirent); | ||||
|    | ||||
|   /**
 | ||||
|      Attempts to read up to count bytes from UDF directory entry | ||||
|      p_udf_dirent into the buffer starting at buf. buf should be a | ||||
|      multiple of UDF_BLOCKSIZE bytes. Reading continues after the | ||||
|      point at which we last read or from the beginning the first time. | ||||
|       | ||||
|      If count is zero, read() returns zero and has no other results. If | ||||
|      count is greater than SSIZE_MAX, the result is unspecified. | ||||
|       | ||||
|      If there is an error, cast the result to driver_return_code_t for  | ||||
|      the specific error code. | ||||
|   */ | ||||
|   /**
 | ||||
|     Attempts to read up to count bytes from file descriptor fd into | ||||
|     the buffer starting at buf. | ||||
|      | ||||
|     If count is zero, read() returns zero and has no other results. If | ||||
|     count is greater than SSIZE_MAX, the result is unspecified. | ||||
|   */ | ||||
|   ssize_t udf_read_block(const udf_dirent_t *p_udf_dirent,  | ||||
| 			 void * buf, size_t count); | ||||
| 
 | ||||
|   /**
 | ||||
|     Advances p_udf_direct to the the next directory entry in the | ||||
|     pointed to by p_udf_dir. It also returns this as the value.  NULL | ||||
|     is returned on reaching the end-of-file or if an error. Also | ||||
|     p_udf_dirent is free'd. If the end of is not reached the caller | ||||
|     must call udf_dirent_free() with p_udf_dirent when done with it to  | ||||
|     release resources. | ||||
|   */ | ||||
|   udf_dirent_t *udf_readdir(udf_dirent_t *p_udf_dirent); | ||||
|    | ||||
|   /**
 | ||||
|     free free resources associated with p_udf_dirent. | ||||
|   */ | ||||
|   bool udf_dirent_free(udf_dirent_t *p_udf_dirent); | ||||
|    | ||||
|   /**
 | ||||
|     Return true if the file is a directory. | ||||
|   */ | ||||
|   bool udf_is_dir(const udf_dirent_t *p_udf_dirent); | ||||
|    | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /*UDF_FILE_H*/ | ||||
							
								
								
									
										87
									
								
								src/libcdio/cdio/udf_time.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								src/libcdio/cdio/udf_time.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,87 @@ | |||
| /*  
 | ||||
|     $Id: udf_time.h,v 1.5 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /*!
 | ||||
|  * \file udf_time.h  | ||||
|  * | ||||
|  * \brief UDF time conversion and access files. | ||||
|  * | ||||
| */ | ||||
| 
 | ||||
| #ifndef UDF_TIME_H | ||||
| #define UDF_TIME_H  | ||||
| 
 | ||||
| #include <time.h> | ||||
| 
 | ||||
| #if defined(__MINGW32__) && !defined(__MINGW64__) | ||||
| struct timespec { | ||||
|   time_t  tv_sec;   /* Seconds */ | ||||
|   long    tv_nsec;  /* Nanoseconds */ | ||||
| }; | ||||
| #endif | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the access time of the file. | ||||
|   */ | ||||
|   time_t udf_get_access_time(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the attribute (most recent create or access) time of the file | ||||
|   */ | ||||
|   time_t udf_get_attribute_time(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the modification time of the file. | ||||
|   */ | ||||
|   time_t udf_get_modification_time(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the access timestamp of the file | ||||
|   */ | ||||
|   udf_timestamp_t *udf_get_access_timestamp(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the modification timestamp of the file | ||||
|   */ | ||||
|   udf_timestamp_t *udf_get_modification_timestamp(const udf_dirent_t  | ||||
| 						  *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the attr timestamp of the file | ||||
|   */ | ||||
|   udf_timestamp_t *udf_get_attr_timestamp(const udf_dirent_t *p_udf_dirent); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Convert a UDF timestamp to a time_t. If microseconds are desired, | ||||
|     use dest_usec. The return value is the same as dest. */ | ||||
|   time_t *udf_stamp_to_time(time_t *dest, long int *dest_usec,  | ||||
| 			  const udf_timestamp_t src); | ||||
| 
 | ||||
|   udf_timestamp_t *udf_timespec_to_stamp(const struct timespec ts, | ||||
| 					 udf_timestamp_t *dest); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /*UDF_TIME_H*/ | ||||
							
								
								
									
										92
									
								
								src/libcdio/cdio/utf8.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								src/libcdio/cdio/utf8.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,92 @@ | |||
| /*
 | ||||
|     $Id: utf8.h,v 1.2 2008/03/25 15:59:09 karl Exp $ | ||||
|      | ||||
|     Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2006 Burkhard Plaum <plaum@ipf.uni-stuttgart.de> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /* UTF-8 support */ | ||||
|  | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| /** \brief Opaque characterset converter
 | ||||
|  */ | ||||
| 
 | ||||
| typedef struct cdio_charset_coverter_s cdio_charset_coverter_t; | ||||
| 
 | ||||
| /** \brief Create a charset converter
 | ||||
|  *  \param src_charset Source charset | ||||
|  *  \param dst_charset Destination charset | ||||
|  *  \returns A newly allocated charset converter | ||||
|  */ | ||||
| 
 | ||||
| cdio_charset_coverter_t * | ||||
| cdio_charset_converter_create(const char * src_charset, | ||||
|                               const char * dst_charset); | ||||
| 
 | ||||
| /** \brief Destroy a characterset converter
 | ||||
|  *  \param cnv A characterset converter | ||||
|  */ | ||||
| 
 | ||||
| void cdio_charset_converter_destroy(cdio_charset_coverter_t*cnv); | ||||
| 
 | ||||
| /** \brief Convert a string from one character set to another
 | ||||
|  *  \param cnv A charset converter | ||||
|  *  \param src Source string | ||||
|  *  \param src_len Length of source string | ||||
|  *  \param dst Returns destination string | ||||
|  *  \param dst_len If non NULL, returns the length of the destination string | ||||
|  *  \returns true if conversion was sucessful, false else. | ||||
|  * | ||||
|  *  The destination string must be freed by the caller with free(). | ||||
|  *  If you pass -1 for src_len, strlen() will be used. | ||||
|  */ | ||||
| 
 | ||||
| bool cdio_charset_convert(cdio_charset_coverter_t*cnv, | ||||
|                           char * src, int src_len, | ||||
|                           char ** dst, int * dst_len); | ||||
| 
 | ||||
| /** \brief Convert a string from UTF-8 to another charset
 | ||||
|  *  \param src Source string (0 terminated) | ||||
|  *  \param dst Returns destination string | ||||
|  *  \param dst_len If non NULL, returns the length of the destination string | ||||
|  *  \param dst_charset The characterset to convert to | ||||
|  *  \returns true if conversion was sucessful, false else. | ||||
|  * | ||||
|  *  This is a convenience function, which creates a charset converter, | ||||
|  *  converts one string and destroys the charset converter. | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
| bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst, | ||||
|                             int * dst_len, const char * dst_charset); | ||||
| 
 | ||||
| /** \brief Convert a string from another charset to UTF-8 
 | ||||
|  *  \param src Source string | ||||
|  *  \param src_len Length of the source string | ||||
|  *  \param dst Returns destination string (0 terminated) | ||||
|  *  \param src_charset The characterset to convert from | ||||
|  *  \returns true if conversion was sucessful, false else. | ||||
|  * | ||||
|  *  This is a convenience function, which creates a charset converter, | ||||
|  *  converts one string and destroys the charset converter. If you pass -1 | ||||
|  *  for src_len, strlen() will be used. | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
| bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst, | ||||
|                           const char * src_charset); | ||||
| 
 | ||||
							
								
								
									
										134
									
								
								src/libcdio/cdio/util.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								src/libcdio/cdio/util.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,134 @@ | |||
| /*
 | ||||
|     Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifndef __CDIO_UTIL_H__ | ||||
| #define __CDIO_UTIL_H__ | ||||
| 
 | ||||
| /*!
 | ||||
|    \file util.h  | ||||
|    \brief Miscellaneous utility functions.  | ||||
| 
 | ||||
|    Warning: this will probably get removed/replaced by using glib.h | ||||
| */ | ||||
| #include <stdlib.h> | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #if !defined CDIO_INLINE | ||||
| #if defined(__cplusplus) || defined(inline) | ||||
| #define CDIO_INLINE inline | ||||
| #elif defined(__GNUC__) | ||||
| #define CDIO_INLINE __inline__ | ||||
| #elif defined(_MSC_VER) | ||||
| #define CDIO_INLINE __inline | ||||
| #else | ||||
| #define CDIO_INLINE | ||||
| #endif | ||||
| #endif /* CDIO_INLINE */ | ||||
| 
 | ||||
| #undef  MAX | ||||
| #define MAX(a, b)  (((a) > (b)) ? (a) : (b)) | ||||
| 
 | ||||
| #undef  MIN | ||||
| #define MIN(a, b)  (((a) < (b)) ? (a) : (b)) | ||||
| 
 | ||||
| #undef  IN | ||||
| #define IN(x, low, high) ((x) >= (low) && (x) <= (high)) | ||||
| 
 | ||||
| #undef  CLAMP | ||||
| #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) | ||||
| 
 | ||||
| static CDIO_INLINE uint32_t | ||||
| _cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize) | ||||
| { | ||||
|   uint32_t i_blocks; | ||||
| 
 | ||||
|   i_blocks = i_len / (uint32_t) i_blocksize; | ||||
|   if (i_len % i_blocksize) | ||||
|     i_blocks++; | ||||
| 
 | ||||
|   return i_blocks; | ||||
| } | ||||
| 
 | ||||
| /* round up to next block boundary */ | ||||
| static CDIO_INLINE unsigned  | ||||
| _cdio_ceil2block (unsigned offset, uint16_t i_blocksize) | ||||
| { | ||||
|   return _cdio_len2blocks (offset, i_blocksize) * i_blocksize; | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE unsigned int | ||||
| _cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize) | ||||
| { | ||||
|   if (i_blocksize - (offset % i_blocksize) < length) | ||||
|     offset = _cdio_ceil2block (offset, i_blocksize); | ||||
| 
 | ||||
|   offset += length; | ||||
| 
 | ||||
|   return offset; | ||||
| } | ||||
| 
 | ||||
| static CDIO_INLINE const char * | ||||
| _cdio_bool_str (bool b) | ||||
| { | ||||
|   return b ? "yes" : "no"; | ||||
| } | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| void * | ||||
| _cdio_memdup (const void *mem, size_t count); | ||||
| 
 | ||||
| char * | ||||
| _cdio_strdup_upper (const char str[]); | ||||
| 
 | ||||
| void | ||||
| _cdio_strfreev(char **strv); | ||||
| 
 | ||||
| size_t | ||||
| _cdio_strlenv(char **str_array); | ||||
| 
 | ||||
| char ** | ||||
| _cdio_strsplit(const char str[], char delim); | ||||
| 
 | ||||
| uint8_t cdio_to_bcd8(uint8_t n); | ||||
| uint8_t cdio_from_bcd8(uint8_t p); | ||||
| 
 | ||||
| /*!  cdio_realpath() same as POSIX.1-2001 realpath if that's
 | ||||
| around. If not we do poor-man's simulation of that behavior.  */ | ||||
| char *cdio_realpath (const char *psz_src, char *psz_dst); | ||||
| 
 | ||||
| #ifdef WANT_FOLLOW_SYMLINK_COMPATIBILITY | ||||
| # define cdio_follow_symlink cdio_realpath | ||||
| #endif | ||||
|    | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __CDIO_UTIL_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										20
									
								
								src/libcdio/cdio/version.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/libcdio/cdio/version.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| /* $Id: version.h.in,v 1.6 2005/01/29 20:54:20 rocky Exp $ */ | ||||
| /** \file version.h 
 | ||||
|  * | ||||
|  *  \brief A file containing the libcdio package version | ||||
|  *  number (84) and OS build name.  | ||||
|  */ | ||||
| 
 | ||||
| /*! CDIO_VERSION is a C-Preprocessor macro of a string that shows what
 | ||||
|     version is used.  cdio_version_string has the same value, but it is a | ||||
|     constant variable that can be accessed at run time. */ | ||||
| #define CDIO_VERSION "0.84git i686-pc-mingw32" | ||||
| extern const char *cdio_version_string; /**< = CDIO_VERSION */ | ||||
| 
 | ||||
| /*! LIBCDIO_VERSION_NUM is a C-Preprocessor macro that can be used for
 | ||||
|     testing in the C preprocessor. libcdio_version_num has the same | ||||
|     value, but it is a constant variable that can be accessed at run | ||||
|     time.  */ | ||||
| #define LIBCDIO_VERSION_NUM 84 | ||||
| 
 | ||||
| extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */ | ||||
							
								
								
									
										179
									
								
								src/libcdio/cdio/xa.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								src/libcdio/cdio/xa.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,179 @@ | |||
| /*
 | ||||
|     $Id: xa.h,v 1.19 2008/03/25 15:59:10 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These are  | ||||
| 
 | ||||
|     Copyright 1993 Yggdrasil Computing, Incorporated | ||||
|     Copyright (c) 1999,2000 J. Schilling | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*!
 | ||||
|    \file xa.h  | ||||
|    \brief Things related to the ISO-9660 XA (Extended Attributes) format | ||||
| 
 | ||||
|    Applications will probably not include this directly but via  | ||||
|    the iso9660.h header. | ||||
| */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_XA_H__ | ||||
| #define __CDIO_XA_H__ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*! An enumeration for some of the XA_* \#defines below. This isn't
 | ||||
|     really an enumeration one would really use in a program it is to | ||||
|     be helpful in debuggers where wants just to refer to the XA_* | ||||
|     names and get something. | ||||
|   */ | ||||
|   typedef enum { | ||||
|     ISO_XA_MARKER_OFFSET =   1024, | ||||
|     XA_PERM_RSYS =         0x0001,  /**< System Group Read */ | ||||
|     XA_PERM_XSYS =         0x0004,  /**< System Group Execute */ | ||||
|      | ||||
|     XA_PERM_RUSR =         0x0010,  /**< User (owner) Read */ | ||||
|     XA_PERM_XUSR =         0x0040,  /**< User (owner) Execute */ | ||||
|      | ||||
|     XA_PERM_RGRP =         0x0100,  /**< Group Read */ | ||||
|     XA_PERM_XGRP =         0x0400,  /**< Group Execute */ | ||||
|      | ||||
|     XA_PERM_ROTH =         0x1000,  /**< Other (world) Read */ | ||||
|     XA_PERM_XOTH =         0x4000,  /**< Other (world) Execute */ | ||||
|      | ||||
|     XA_ATTR_MODE2FORM1  =   (1 << 11), | ||||
|     XA_ATTR_MODE2FORM2  =   (1 << 12), | ||||
|     XA_ATTR_INTERLEAVED =   (1 << 13), | ||||
|     XA_ATTR_CDDA        =   (1 << 14), | ||||
|     XA_ATTR_DIRECTORY   =   (1 << 15), | ||||
|      | ||||
|     XA_PERM_ALL_READ    =   (XA_PERM_RUSR | XA_PERM_RSYS | XA_PERM_RGRP), | ||||
|     XA_PERM_ALL_EXEC    =   (XA_PERM_XUSR | XA_PERM_XSYS | XA_PERM_XGRP), | ||||
|     XA_PERM_ALL_ALL     =   (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC), | ||||
|      | ||||
|     XA_FORM1_DIR  = (XA_ATTR_DIRECTORY | XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL), | ||||
|     XA_FORM1_FILE =  (XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL), | ||||
|     XA_FORM2_FILE =  (XA_ATTR_MODE2FORM2 | XA_PERM_ALL_ALL) | ||||
|   } xa_misc_enum_t; | ||||
|    | ||||
| extern const char ISO_XA_MARKER_STRING[sizeof("CD-XA001")-1]; | ||||
| 
 | ||||
| #define ISO_XA_MARKER_STRING    "CD-XA001" | ||||
| 
 | ||||
| /*! \brief "Extended Architecture" according to the Philips Yellow Book.
 | ||||
|   | ||||
| CD-ROM EXtended Architecture is a modification to the CD-ROM | ||||
| specification that defines two new types of sectors.  CD-ROM XA was | ||||
| developed jointly by Sony, Philips, and Microsoft, and announced in | ||||
| August 1988. Its specifications were published in an extension to the | ||||
| Yellow Book.  CD-i, Photo CD, Video CD and CD-EXTRA have all | ||||
| subsequently been based on CD-ROM XA. | ||||
| 
 | ||||
| CD-XA defines another way of formatting sectors on a CD-ROM, including | ||||
| headers in the sectors that describe the type (audio, video, data) and | ||||
| some additional info (markers, resolution in case of a video or audio | ||||
| sector, file numbers, etc). | ||||
| 
 | ||||
| The data written on a CD-XA is consistent with and can be in ISO-9660 | ||||
| file system format and therefore be readable by ISO-9660 file system | ||||
| translators. But also a CD-I player can also read CD-XA discs even if | ||||
| its own `Green Book' file system only resembles ISO 9660 and isn't | ||||
| fully compatible.  | ||||
| 
 | ||||
|  Note structure is big-endian. | ||||
| */ | ||||
| typedef struct iso9660_xa_s | ||||
| { | ||||
|   uint16_t group_id;      /**< 0 */ | ||||
|   uint16_t user_id;       /**< 0 */ | ||||
|   uint16_t attributes;    /**< XA_ATTR_ */  | ||||
|   char     signature[2];  /**< { 'X', 'A' } */ | ||||
|   uint8_t  filenum;       /**< file number, see also XA subheader */ | ||||
|   uint8_t  reserved[5];   /**< zero */ | ||||
| } GNUC_PACKED iso9660_xa_t; | ||||
|    | ||||
|    | ||||
|   /*!
 | ||||
|     Returns POSIX mode bitstring for a given file. | ||||
|   */ | ||||
|   posix_mode_t iso9660_get_posix_filemode_from_xa(uint16_t i_perms); | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns a string interpreting the extended attribute xa_attr.  | ||||
|   For example: | ||||
|   \verbatim | ||||
|   d---1xrxrxr | ||||
|   ---2--r-r-r | ||||
|   -a--1xrxrxr | ||||
|   \endverbatim | ||||
|    | ||||
|   A description of the characters in the string follows. | ||||
|   The 1st character is either "d" if the entry is a directory, or "-" if not | ||||
|   The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not | ||||
|   The 3rd character is either "i" if the entry is interleaved, or "-" if not | ||||
|   The 4th character is either "2" if the entry is mode2 form2 or "-" if not | ||||
|   The 5th character is either "1" if the entry is mode2 form1 or "-" if not | ||||
|   Note that an entry will either be in mode2 form1 or mode form2. That | ||||
|   is you will either see "2-" or "-1" in the 4th & 5th positions. | ||||
|    | ||||
|   The 6th and 7th characters refer to permissions for a user while the | ||||
|   the 8th and 9th characters refer to permissions for a group while, and  | ||||
|   the 10th and 11th characters refer to permissions for everyone.  | ||||
|    | ||||
|   In each of these pairs the first character (6, 8, 10) is "x" if the  | ||||
|   entry is executable. For a directory this means the directory is | ||||
|   allowed to be listed or "searched". | ||||
|   The second character of a pair (7, 9, 11) is "r" if the entry is allowed | ||||
|   to be read.  | ||||
| */ | ||||
| const char * | ||||
| iso9660_get_xa_attr_str (uint16_t xa_attr); | ||||
|    | ||||
| /*! 
 | ||||
|   Allocates and initalizes a new iso9600_xa_t variable and returns | ||||
|   it. The caller should free the returned result. | ||||
| 
 | ||||
|   @see iso9660_xa | ||||
| */ | ||||
| iso9660_xa_t * | ||||
| iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,  | ||||
| 		 uint8_t filenum); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| 
 | ||||
| /** The below variables are trickery to force the above enum symbol
 | ||||
|     values to be recorded in debug symbol tables. They are used to | ||||
|     allow one to refer to the enumeration value names in the typedefs | ||||
|     above in a debugger and debugger expressions. | ||||
| */ | ||||
| extern xa_misc_enum_t debugger_xa_misc_enum; | ||||
| 
 | ||||
|    | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_XA_H__ */ | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										188
									
								
								src/libcdio/driver/.msvc/driver.vcxproj
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								src/libcdio/driver/.msvc/driver.vcxproj
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,188 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\disc.c" /> | ||||
|     <ClCompile Include="..\ds.c" /> | ||||
|     <ClCompile Include="..\logging.c" /> | ||||
|     <ClCompile Include="..\read.c" /> | ||||
|     <ClCompile Include="..\sector.c" /> | ||||
|     <ClCompile Include="..\track.c" /> | ||||
|     <ClCompile Include="..\utf8.c" /> | ||||
|     <ClCompile Include="..\util.c" /> | ||||
|     <ClCompile Include="..\_cdio_stdio.c" /> | ||||
|     <ClCompile Include="..\_cdio_stream.c" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\..\cdio\cdio.h" /> | ||||
|     <ClInclude Include="..\..\cdio\ds.h" /> | ||||
|     <ClInclude Include="..\..\cdio\logging.h" /> | ||||
|     <ClInclude Include="..\..\cdio\sector.h" /> | ||||
|     <ClInclude Include="..\..\cdio\types.h" /> | ||||
|     <ClInclude Include="..\..\cdio\util.h" /> | ||||
|     <ClInclude Include="..\..\cdio\version.h" /> | ||||
|     <ClInclude Include="..\..\config.h" /> | ||||
|     <ClInclude Include="..\cdio_assert.h" /> | ||||
|     <ClInclude Include="..\cdio_private.h" /> | ||||
|     <ClInclude Include="..\filemode.h" /> | ||||
|     <ClInclude Include="..\portable.h" /> | ||||
|     <ClInclude Include="..\_cdio_stdio.h" /> | ||||
|     <ClInclude Include="..\_cdio_stream.h" /> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>{FA1B1093-BA86-410A-B7A0-7A54C605F812}</ProjectGuid> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <RootNamespace>driver</RootNamespace> | ||||
|     <ProjectName>libcdio-driver</ProjectName> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup> | ||||
|     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										89
									
								
								src/libcdio/driver/.msvc/driver.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								src/libcdio/driver/.msvc/driver.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,89 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="Source Files"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="Header Files"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\_cdio_stdio.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\_cdio_stream.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\logging.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\ds.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\read.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\util.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\sector.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\disc.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\track.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\utf8.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\_cdio_stdio.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\_cdio_stream.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\cdio_assert.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\cdio_private.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\filemode.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\logging.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\util.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\cdio.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\ds.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\types.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\config.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\portable.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\sector.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\version.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										25
									
								
								src/libcdio/driver/.msvc/driver_sources
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/libcdio/driver/.msvc/driver_sources
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| TARGETNAME=driver | ||||
| TARGETTYPE=LIBRARY | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.;..;..\..\msvc-missing | ||||
| LIBCDIO_DEFINES = /DHAVE_CONFIG_H /D_OFF_T_DEFINED /D_off_t=__int64 /Doff_t=_off_t /D_FILE_OFFSET_BITS=64 | ||||
| C_DEFINES=$(C_DEFINES) $(LIBCDIO_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
| MSC_WARNING_LEVEL=/W3 | ||||
| !ENDIF | ||||
| USE_MSVCRT=1 | ||||
| 
 | ||||
| TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ | ||||
|            $(SDK_LIB_PATH)\user32.lib | ||||
| 
 | ||||
| SOURCES=disc.c     \ | ||||
| 	ds.c             \ | ||||
| 	logging.c        \ | ||||
| 	read.c           \ | ||||
| 	sector.c         \ | ||||
| 	track.c          \ | ||||
| 	util.c           \ | ||||
| 	utf8.c           \ | ||||
| 	_cdio_stdio.c    \ | ||||
| 	_cdio_stream.c | ||||
							
								
								
									
										4
									
								
								src/libcdio/driver/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/libcdio/driver/Makefile.am
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| noinst_LIBRARIES = libdriver.a | ||||
| libdriver_a_SOURCES = disc.c ds.c logging.c read.c sector.c track.c util.c _cdio_stdio.c _cdio_stream.c utf8.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang! | ||||
| libdriver_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. | ||||
							
								
								
									
										476
									
								
								src/libcdio/driver/Makefile.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										476
									
								
								src/libcdio/driver/Makefile.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,476 @@ | |||
| # Makefile.in generated by automake 1.11.1 from Makefile.am.
 | ||||
| # @configure_input@
 | ||||
| 
 | ||||
| # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 | ||||
| # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
 | ||||
| # Inc.
 | ||||
| # This Makefile.in is free software; the Free Software Foundation
 | ||||
| # gives unlimited permission to copy and/or distribute it,
 | ||||
| # with or without modifications, as long as this notice is preserved.
 | ||||
| 
 | ||||
| # This program is distributed in the hope that it will be useful,
 | ||||
| # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 | ||||
| # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 | ||||
| # PARTICULAR PURPOSE.
 | ||||
| 
 | ||||
| @SET_MAKE@ | ||||
| 
 | ||||
| VPATH = @srcdir@ | ||||
| pkgdatadir = $(datadir)/@PACKAGE@ | ||||
| pkgincludedir = $(includedir)/@PACKAGE@ | ||||
| pkglibdir = $(libdir)/@PACKAGE@ | ||||
| pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||||
| am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||||
| install_sh_DATA = $(install_sh) -c -m 644 | ||||
| install_sh_PROGRAM = $(install_sh) -c | ||||
| install_sh_SCRIPT = $(install_sh) -c | ||||
| INSTALL_HEADER = $(INSTALL_DATA) | ||||
| transform = $(program_transform_name) | ||||
| NORMAL_INSTALL = : | ||||
| PRE_INSTALL = : | ||||
| POST_INSTALL = : | ||||
| NORMAL_UNINSTALL = : | ||||
| PRE_UNINSTALL = : | ||||
| POST_UNINSTALL = : | ||||
| subdir = src/libcdio/driver | ||||
| DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am | ||||
| ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||||
| am__aclocal_m4_deps = $(top_srcdir)/configure.ac | ||||
| am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 | ||||
| 	$(ACLOCAL_M4) | ||||
| mkinstalldirs = $(install_sh) -d | ||||
| CONFIG_CLEAN_FILES = | ||||
| CONFIG_CLEAN_VPATH_FILES = | ||||
| LIBRARIES = $(noinst_LIBRARIES) | ||||
| AR = ar | ||||
| ARFLAGS = cru | ||||
| AM_V_AR = $(am__v_AR_$(V)) | ||||
| am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_AR_0 = @echo "  AR    " $@; | ||||
| AM_V_at = $(am__v_at_$(V)) | ||||
| am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_at_0 = @ | ||||
| libdriver_a_AR = $(AR) $(ARFLAGS) | ||||
| libdriver_a_LIBADD = | ||||
| am_libdriver_a_OBJECTS = libdriver_a-disc.$(OBJEXT) \
 | ||||
| 	libdriver_a-ds.$(OBJEXT) libdriver_a-logging.$(OBJEXT) \
 | ||||
| 	libdriver_a-read.$(OBJEXT) libdriver_a-sector.$(OBJEXT) \
 | ||||
| 	libdriver_a-track.$(OBJEXT) libdriver_a-util.$(OBJEXT) \
 | ||||
| 	libdriver_a-_cdio_stdio.$(OBJEXT) \
 | ||||
| 	libdriver_a-_cdio_stream.$(OBJEXT) libdriver_a-utf8.$(OBJEXT) | ||||
| libdriver_a_OBJECTS = $(am_libdriver_a_OBJECTS) | ||||
| DEFAULT_INCLUDES = -I.@am__isrc@ | ||||
| depcomp = | ||||
| am__depfiles_maybe = | ||||
| AM_V_lt = $(am__v_lt_$(V)) | ||||
| am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_lt_0 = --silent | ||||
| COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 | ||||
| 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||
| AM_V_CC = $(am__v_CC_$(V)) | ||||
| am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CC_0 = @echo "  CC    " $@; | ||||
| CCLD = $(CC) | ||||
| LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||||
| AM_V_CCLD = $(am__v_CCLD_$(V)) | ||||
| am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CCLD_0 = @echo "  CCLD  " $@; | ||||
| AM_V_GEN = $(am__v_GEN_$(V)) | ||||
| am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_GEN_0 = @echo "  GEN   " $@; | ||||
| SOURCES = $(libdriver_a_SOURCES) | ||||
| ETAGS = etags | ||||
| CTAGS = ctags | ||||
| ACLOCAL = @ACLOCAL@ | ||||
| AMTAR = @AMTAR@ | ||||
| AM_CFLAGS = @AM_CFLAGS@ | ||||
| AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||||
| AM_LDFLAGS = @AM_LDFLAGS@ | ||||
| AM_RCFLAGS = @AM_RCFLAGS@ | ||||
| AUTOCONF = @AUTOCONF@ | ||||
| AUTOHEADER = @AUTOHEADER@ | ||||
| AUTOMAKE = @AUTOMAKE@ | ||||
| AWK = @AWK@ | ||||
| CC = @CC@ | ||||
| CFLAGS = @CFLAGS@ | ||||
| CPPFLAGS = @CPPFLAGS@ | ||||
| CYGPATH_W = @CYGPATH_W@ | ||||
| DEFS = @DEFS@ | ||||
| ECHO_C = @ECHO_C@ | ||||
| ECHO_N = @ECHO_N@ | ||||
| ECHO_T = @ECHO_T@ | ||||
| EXEEXT = @EXEEXT@ | ||||
| EXESUFFIX = @EXESUFFIX@ | ||||
| INSTALL = @INSTALL@ | ||||
| INSTALL_DATA = @INSTALL_DATA@ | ||||
| INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||||
| INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||||
| INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||||
| LDFLAGS = @LDFLAGS@ | ||||
| LIBOBJS = @LIBOBJS@ | ||||
| LIBS = @LIBS@ | ||||
| LTLIBOBJS = @LTLIBOBJS@ | ||||
| MAKEINFO = @MAKEINFO@ | ||||
| MKDIR_P = @MKDIR_P@ | ||||
| OBJEXT = @OBJEXT@ | ||||
| PACKAGE = @PACKAGE@ | ||||
| PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||||
| PACKAGE_NAME = @PACKAGE_NAME@ | ||||
| PACKAGE_STRING = @PACKAGE_STRING@ | ||||
| PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||||
| PACKAGE_URL = @PACKAGE_URL@ | ||||
| PACKAGE_VERSION = @PACKAGE_VERSION@ | ||||
| PATH_SEPARATOR = @PATH_SEPARATOR@ | ||||
| RANLIB = @RANLIB@ | ||||
| RM = @RM@ | ||||
| SET_MAKE = @SET_MAKE@ | ||||
| SHELL = @SHELL@ | ||||
| STRIP = @STRIP@ | ||||
| VERSION = @VERSION@ | ||||
| VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@ | ||||
| WINDRES = @WINDRES@ | ||||
| abs_builddir = @abs_builddir@ | ||||
| abs_srcdir = @abs_srcdir@ | ||||
| abs_top_builddir = @abs_top_builddir@ | ||||
| abs_top_srcdir = @abs_top_srcdir@ | ||||
| ac_ct_CC = @ac_ct_CC@ | ||||
| am__leading_dot = @am__leading_dot@ | ||||
| am__tar = @am__tar@ | ||||
| am__untar = @am__untar@ | ||||
| bindir = @bindir@ | ||||
| build_alias = @build_alias@ | ||||
| builddir = @builddir@ | ||||
| datadir = @datadir@ | ||||
| datarootdir = @datarootdir@ | ||||
| docdir = @docdir@ | ||||
| dvidir = @dvidir@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| host_alias = @host_alias@ | ||||
| htmldir = @htmldir@ | ||||
| includedir = @includedir@ | ||||
| infodir = @infodir@ | ||||
| install_sh = @install_sh@ | ||||
| libdir = @libdir@ | ||||
| libexecdir = @libexecdir@ | ||||
| localedir = @localedir@ | ||||
| localstatedir = @localstatedir@ | ||||
| mandir = @mandir@ | ||||
| mkdir_p = @mkdir_p@ | ||||
| oldincludedir = @oldincludedir@ | ||||
| pdfdir = @pdfdir@ | ||||
| prefix = @prefix@ | ||||
| program_transform_name = @program_transform_name@ | ||||
| psdir = @psdir@ | ||||
| sbindir = @sbindir@ | ||||
| sharedstatedir = @sharedstatedir@ | ||||
| srcdir = @srcdir@ | ||||
| sysconfdir = @sysconfdir@ | ||||
| target_alias = @target_alias@ | ||||
| top_build_prefix = @top_build_prefix@ | ||||
| top_builddir = @top_builddir@ | ||||
| top_srcdir = @top_srcdir@ | ||||
| noinst_LIBRARIES = libdriver.a | ||||
| libdriver_a_SOURCES = disc.c ds.c logging.c read.c sector.c track.c util.c _cdio_stdio.c _cdio_stream.c utf8.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang!
 | ||||
| libdriver_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. | ||||
| all: all-am | ||||
| 
 | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c .o .obj | ||||
| $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps) | ||||
| 	@for dep in $?; do \
 | ||||
| 	  case '$(am__configure_deps)' in \
 | ||||
| 	    *$$dep*) \
 | ||||
| 	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
 | ||||
| 	        && { if test -f $@; then exit 0; else break; fi; }; \
 | ||||
| 	      exit 1;; \
 | ||||
| 	  esac; \
 | ||||
| 	done; \
 | ||||
| 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/libcdio/driver/Makefile'; \
 | ||||
| 	$(am__cd) $(top_srcdir) && \
 | ||||
| 	  $(AUTOMAKE) --foreign --ignore-deps src/libcdio/driver/Makefile | ||||
| .PRECIOUS: Makefile | ||||
| Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||||
| 	@case '$?' in \
 | ||||
| 	  *config.status*) \
 | ||||
| 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 | ||||
| 	  *) \
 | ||||
| 	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
 | ||||
| 	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
 | ||||
| 	esac; | ||||
| 
 | ||||
| $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| 
 | ||||
| $(top_srcdir)/configure:  $(am__configure_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(ACLOCAL_M4):  $(am__aclocal_m4_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(am__aclocal_m4_deps): | ||||
| 
 | ||||
| clean-noinstLIBRARIES: | ||||
| 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) | ||||
| libdriver.a: $(libdriver_a_OBJECTS) $(libdriver_a_DEPENDENCIES)  | ||||
| 	$(AM_V_at)-rm -f libdriver.a | ||||
| 	$(AM_V_AR)$(libdriver_a_AR) libdriver.a $(libdriver_a_OBJECTS) $(libdriver_a_LIBADD) | ||||
| 	$(AM_V_at)$(RANLIB) libdriver.a | ||||
| 
 | ||||
| mostlyclean-compile: | ||||
| 	-rm -f *.$(OBJEXT) | ||||
| 
 | ||||
| distclean-compile: | ||||
| 	-rm -f *.tab.c | ||||
| 
 | ||||
| .c.o: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c $< | ||||
| 
 | ||||
| .c.obj: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c `$(CYGPATH_W) '$<'` | ||||
| 
 | ||||
| libdriver_a-disc.o: disc.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-disc.o `test -f 'disc.c' || echo '$(srcdir)/'`disc.c | ||||
| 
 | ||||
| libdriver_a-disc.obj: disc.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-disc.obj `if test -f 'disc.c'; then $(CYGPATH_W) 'disc.c'; else $(CYGPATH_W) '$(srcdir)/disc.c'; fi` | ||||
| 
 | ||||
| libdriver_a-ds.o: ds.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-ds.o `test -f 'ds.c' || echo '$(srcdir)/'`ds.c | ||||
| 
 | ||||
| libdriver_a-ds.obj: ds.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-ds.obj `if test -f 'ds.c'; then $(CYGPATH_W) 'ds.c'; else $(CYGPATH_W) '$(srcdir)/ds.c'; fi` | ||||
| 
 | ||||
| libdriver_a-logging.o: logging.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-logging.o `test -f 'logging.c' || echo '$(srcdir)/'`logging.c | ||||
| 
 | ||||
| libdriver_a-logging.obj: logging.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-logging.obj `if test -f 'logging.c'; then $(CYGPATH_W) 'logging.c'; else $(CYGPATH_W) '$(srcdir)/logging.c'; fi` | ||||
| 
 | ||||
| libdriver_a-read.o: read.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-read.o `test -f 'read.c' || echo '$(srcdir)/'`read.c | ||||
| 
 | ||||
| libdriver_a-read.obj: read.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-read.obj `if test -f 'read.c'; then $(CYGPATH_W) 'read.c'; else $(CYGPATH_W) '$(srcdir)/read.c'; fi` | ||||
| 
 | ||||
| libdriver_a-sector.o: sector.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-sector.o `test -f 'sector.c' || echo '$(srcdir)/'`sector.c | ||||
| 
 | ||||
| libdriver_a-sector.obj: sector.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-sector.obj `if test -f 'sector.c'; then $(CYGPATH_W) 'sector.c'; else $(CYGPATH_W) '$(srcdir)/sector.c'; fi` | ||||
| 
 | ||||
| libdriver_a-track.o: track.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-track.o `test -f 'track.c' || echo '$(srcdir)/'`track.c | ||||
| 
 | ||||
| libdriver_a-track.obj: track.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-track.obj `if test -f 'track.c'; then $(CYGPATH_W) 'track.c'; else $(CYGPATH_W) '$(srcdir)/track.c'; fi` | ||||
| 
 | ||||
| libdriver_a-util.o: util.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c | ||||
| 
 | ||||
| libdriver_a-util.obj: util.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi` | ||||
| 
 | ||||
| libdriver_a-_cdio_stdio.o: _cdio_stdio.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-_cdio_stdio.o `test -f '_cdio_stdio.c' || echo '$(srcdir)/'`_cdio_stdio.c | ||||
| 
 | ||||
| libdriver_a-_cdio_stdio.obj: _cdio_stdio.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-_cdio_stdio.obj `if test -f '_cdio_stdio.c'; then $(CYGPATH_W) '_cdio_stdio.c'; else $(CYGPATH_W) '$(srcdir)/_cdio_stdio.c'; fi` | ||||
| 
 | ||||
| libdriver_a-_cdio_stream.o: _cdio_stream.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-_cdio_stream.o `test -f '_cdio_stream.c' || echo '$(srcdir)/'`_cdio_stream.c | ||||
| 
 | ||||
| libdriver_a-_cdio_stream.obj: _cdio_stream.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-_cdio_stream.obj `if test -f '_cdio_stream.c'; then $(CYGPATH_W) '_cdio_stream.c'; else $(CYGPATH_W) '$(srcdir)/_cdio_stream.c'; fi` | ||||
| 
 | ||||
| libdriver_a-utf8.o: utf8.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-utf8.o `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c | ||||
| 
 | ||||
| libdriver_a-utf8.obj: utf8.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdriver_a_CFLAGS) $(CFLAGS) -c -o libdriver_a-utf8.obj `if test -f 'utf8.c'; then $(CYGPATH_W) 'utf8.c'; else $(CYGPATH_W) '$(srcdir)/utf8.c'; fi` | ||||
| 
 | ||||
| ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||||
| 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	mkid -fID $$unique | ||||
| tags: TAGS | ||||
| 
 | ||||
| TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	set x; \
 | ||||
| 	here=`pwd`; \
 | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	shift; \
 | ||||
| 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 | ||||
| 	  test -n "$$unique" || unique=$$empty_fix; \
 | ||||
| 	  if test $$# -gt 0; then \ | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      "$$@" $$unique; \
 | ||||
| 	  else \
 | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      $$unique; \
 | ||||
| 	  fi; \
 | ||||
| 	fi | ||||
| ctags: CTAGS | ||||
| CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	test -z "$(CTAGS_ARGS)$$unique" \
 | ||||
| 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 | ||||
| 	     $$unique | ||||
| 
 | ||||
| GTAGS: | ||||
| 	here=`$(am__cd) $(top_builddir) && pwd` \
 | ||||
| 	  && $(am__cd) $(top_srcdir) \
 | ||||
| 	  && gtags -i $(GTAGS_ARGS) "$$here" | ||||
| 
 | ||||
| distclean-tags: | ||||
| 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||||
| check-am: all-am | ||||
| check: check-am | ||||
| all-am: Makefile $(LIBRARIES) | ||||
| installdirs: | ||||
| install: install-am | ||||
| install-exec: install-exec-am | ||||
| install-data: install-data-am | ||||
| uninstall: uninstall-am | ||||
| 
 | ||||
| install-am: all-am | ||||
| 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||||
| 
 | ||||
| installcheck: installcheck-am | ||||
| install-strip: | ||||
| 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
 | ||||
| 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
 | ||||
| 	  `test -z '$(STRIP)' || \
 | ||||
| 	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||||
| mostlyclean-generic: | ||||
| 
 | ||||
| clean-generic: | ||||
| 
 | ||||
| distclean-generic: | ||||
| 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||||
| 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||||
| 
 | ||||
| maintainer-clean-generic: | ||||
| 	@echo "This command is intended for maintainers to use" | ||||
| 	@echo "it deletes files that may require special tools to rebuild." | ||||
| clean: clean-am | ||||
| 
 | ||||
| clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am | ||||
| 
 | ||||
| distclean: distclean-am | ||||
| 	-rm -f Makefile | ||||
| distclean-am: clean-am distclean-compile distclean-generic \ | ||||
| 	distclean-tags | ||||
| 
 | ||||
| dvi: dvi-am | ||||
| 
 | ||||
| dvi-am: | ||||
| 
 | ||||
| html: html-am | ||||
| 
 | ||||
| html-am: | ||||
| 
 | ||||
| info: info-am | ||||
| 
 | ||||
| info-am: | ||||
| 
 | ||||
| install-data-am: | ||||
| 
 | ||||
| install-dvi: install-dvi-am | ||||
| 
 | ||||
| install-dvi-am: | ||||
| 
 | ||||
| install-exec-am: | ||||
| 
 | ||||
| install-html: install-html-am | ||||
| 
 | ||||
| install-html-am: | ||||
| 
 | ||||
| install-info: install-info-am | ||||
| 
 | ||||
| install-info-am: | ||||
| 
 | ||||
| install-man: | ||||
| 
 | ||||
| install-pdf: install-pdf-am | ||||
| 
 | ||||
| install-pdf-am: | ||||
| 
 | ||||
| install-ps: install-ps-am | ||||
| 
 | ||||
| install-ps-am: | ||||
| 
 | ||||
| installcheck-am: | ||||
| 
 | ||||
| maintainer-clean: maintainer-clean-am | ||||
| 	-rm -f Makefile | ||||
| maintainer-clean-am: distclean-am maintainer-clean-generic | ||||
| 
 | ||||
| mostlyclean: mostlyclean-am | ||||
| 
 | ||||
| mostlyclean-am: mostlyclean-compile mostlyclean-generic | ||||
| 
 | ||||
| pdf: pdf-am | ||||
| 
 | ||||
| pdf-am: | ||||
| 
 | ||||
| ps: ps-am | ||||
| 
 | ||||
| ps-am: | ||||
| 
 | ||||
| uninstall-am: | ||||
| 
 | ||||
| .MAKE: install-am install-strip | ||||
| 
 | ||||
| .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||||
| 	clean-noinstLIBRARIES ctags distclean distclean-compile \
 | ||||
| 	distclean-generic distclean-tags dvi dvi-am html html-am info \
 | ||||
| 	info-am install install-am install-data install-data-am \
 | ||||
| 	install-dvi install-dvi-am install-exec install-exec-am \
 | ||||
| 	install-html install-html-am install-info install-info-am \
 | ||||
| 	install-man install-pdf install-pdf-am install-ps \
 | ||||
| 	install-ps-am install-strip installcheck installcheck-am \
 | ||||
| 	installdirs maintainer-clean maintainer-clean-generic \
 | ||||
| 	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
 | ||||
| 	ps ps-am tags uninstall uninstall-am | ||||
| 
 | ||||
| 
 | ||||
| # Tell versions [3.59,3.63) of GNU make to not export all variables.
 | ||||
| # Otherwise a system limit (for SysV at least) may be exceeded.
 | ||||
| .NOEXPORT: | ||||
							
								
								
									
										260
									
								
								src/libcdio/driver/_cdio_stdio.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								src/libcdio/driver/_cdio_stdio.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,260 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| #ifdef HAVE_UNISTD_H | ||||
| #include <unistd.h>  | ||||
| #endif | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| #include <sys/stat.h> | ||||
| #endif | ||||
| #ifdef HAVE_ERRNO_H | ||||
| #include <errno.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/logging.h> | ||||
| #include <cdio/util.h> | ||||
| #include "_cdio_stream.h" | ||||
| #include "_cdio_stdio.h" | ||||
| 
 | ||||
| /* On 32 bit platforms, fseek can only access streams of 2 GB or less.
 | ||||
|    Prefer fseeko/fseeko64, that take a 64 bit offset when LFS is enabled */ | ||||
| #if defined(HAVE_FSEEKO64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) | ||||
| #define CDIO_FSEEK fseeko64 | ||||
| #elif defined(HAVE_FSEEKO) | ||||
| #define CDIO_FSEEK fseeko | ||||
| #else | ||||
| #define CDIO_FSEEK fseek | ||||
| #endif | ||||
| 
 | ||||
| /* Use _stati64 if needed, on platforms that don't have transparent LFS support */ | ||||
| #if defined(HAVE__STATI64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) | ||||
| #define CDIO_STAT _stati64 | ||||
| #else | ||||
| #define CDIO_STAT stat | ||||
| #endif | ||||
| 
 | ||||
| #define _STRINGIFY(a) #a | ||||
| #define STRINGIFY(a) _STRINGIFY(a) | ||||
| 
 | ||||
| static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $"; | ||||
| 
 | ||||
| #define CDIO_STDIO_BUFSIZE (128*1024) | ||||
| 
 | ||||
| typedef struct { | ||||
|   char *pathname; | ||||
|   FILE *fd; | ||||
|   char *fd_buf; | ||||
|   off_t st_size; /* used only for source */ | ||||
| } _UserData; | ||||
| 
 | ||||
| static int | ||||
| _stdio_open (void *user_data)  | ||||
| { | ||||
|   _UserData *const ud = user_data; | ||||
|    | ||||
|   if ((ud->fd = fopen (ud->pathname, "rb"))) | ||||
|     { | ||||
|       ud->fd_buf = calloc (1, CDIO_STDIO_BUFSIZE); | ||||
|       setvbuf (ud->fd, ud->fd_buf, _IOFBF, CDIO_STDIO_BUFSIZE); | ||||
|     } | ||||
| 
 | ||||
|   return (ud->fd == NULL); | ||||
| } | ||||
| 
 | ||||
| static int | ||||
| _stdio_close(void *user_data) | ||||
| { | ||||
|   _UserData *const ud = user_data; | ||||
| 
 | ||||
|   if (fclose (ud->fd)) | ||||
|     cdio_error ("fclose (): %s", strerror (errno)); | ||||
|   | ||||
|   ud->fd = NULL; | ||||
| 
 | ||||
|   free (ud->fd_buf); | ||||
|   ud->fd_buf = NULL; | ||||
| 
 | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| _stdio_free(void *user_data) | ||||
| { | ||||
|   _UserData *const ud = user_data; | ||||
| 
 | ||||
|   if (ud->pathname) | ||||
|     free(ud->pathname); | ||||
| 
 | ||||
|   if (ud->fd) /* should be NULL anyway... */ | ||||
|     _stdio_close(user_data);  | ||||
| 
 | ||||
|   free(ud); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Like fseek/fseeko(3) and in fact may be the same. | ||||
|    | ||||
|   This  function sets the file position indicator for the stream | ||||
|   pointed to by stream.  The new position, measured in bytes, is obtained | ||||
|   by  adding offset bytes to the position specified by whence.  If whence | ||||
|   is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset  is  relative  to | ||||
|   the  start of the file, the current position indicator, or end-of-file, | ||||
|   respectively.  A successful call to the fseek function clears the end- | ||||
|   of-file indicator for the stream and undoes any effects of the | ||||
|   ungetc(3) function on the same stream. | ||||
|    | ||||
|   @return upon successful completion, DRIVER_OP_SUCCESS, else, | ||||
|   DRIVER_OP_ERROR is returned and the global variable errno is set to | ||||
|   indicate the error. | ||||
| */ | ||||
| static int  | ||||
| _stdio_seek(void *p_user_data, off_t i_offset, int whence) | ||||
| { | ||||
|   _UserData *const ud = p_user_data; | ||||
|   int ret; | ||||
| #if !defined(HAVE_FSEEKO) && !defined(HAVE_FSEEKO64) | ||||
|   /* Detect if off_t is lossy-truncated to long to avoid data corruption */ | ||||
|   if ( (sizeof(off_t) > sizeof(long)) && (i_offset != (off_t)((long)i_offset)) ) { | ||||
|     cdio_error ( STRINGIFY(CDIO_FSEEK) " (): lossy truncation detected!"); | ||||
|     errno = EFBIG; | ||||
|     return DRIVER_OP_ERROR; | ||||
|   } | ||||
| #endif | ||||
| 
 | ||||
|   if ( (ret=CDIO_FSEEK (ud->fd, i_offset, whence)) ) { | ||||
|     cdio_error ( STRINGIFY(CDIO_FSEEK) " (): %s", strerror (errno)); | ||||
|   } | ||||
| 
 | ||||
|   return ret; | ||||
| } | ||||
| 
 | ||||
| static off_t | ||||
| _stdio_stat(void *p_user_data) | ||||
| { | ||||
|   const _UserData *const ud = p_user_data; | ||||
| 
 | ||||
|   return ud->st_size; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Like fread(3) and in fact is about the same. | ||||
|    | ||||
|   DESCRIPTION: | ||||
|   The function fread reads nmemb elements of data, each size bytes long, | ||||
|   from the stream pointed to by stream, storing them at the location | ||||
|   given by ptr. | ||||
|    | ||||
|   RETURN VALUE: | ||||
|   return the number of items successfully read or written (i.e., | ||||
|   not the number of characters).  If an error occurs, or the | ||||
|   end-of-file is reached, the return value is a short item count | ||||
|   (or zero). | ||||
|    | ||||
|   We do not distinguish between end-of-file and error, and callers | ||||
|   must use feof(3) and ferror(3) to determine which occurred. | ||||
|   */ | ||||
| static ssize_t | ||||
| _stdio_read(void *user_data, void *buf, size_t count) | ||||
| { | ||||
|   _UserData *const ud = user_data; | ||||
|   long read_count; | ||||
| 
 | ||||
|   read_count = fread(buf, 1, count, ud->fd); | ||||
| 
 | ||||
|   if (read_count != count) | ||||
|     { /* fixme -- ferror/feof */ | ||||
|       if (feof (ud->fd)) | ||||
|         { | ||||
|           cdio_debug ("fread (): EOF encountered"); | ||||
|           clearerr (ud->fd); | ||||
|         } | ||||
|       else if (ferror (ud->fd)) | ||||
|         { | ||||
|           cdio_error ("fread (): %s", strerror (errno)); | ||||
|           clearerr (ud->fd); | ||||
|         } | ||||
|       else | ||||
|         cdio_debug ("fread (): short read and no EOF?!?"); | ||||
|     } | ||||
| 
 | ||||
|   return read_count; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Deallocate resources assocaited with obj. After this obj is unusable. | ||||
| */ | ||||
| void | ||||
| cdio_stdio_destroy(CdioDataSource_t *p_obj) | ||||
| { | ||||
|   cdio_stream_destroy(p_obj); | ||||
| } | ||||
| 
 | ||||
| CdioDataSource_t * | ||||
| cdio_stdio_new(const char pathname[]) | ||||
| { | ||||
|   CdioDataSource_t *new_obj = NULL; | ||||
|   cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL }; | ||||
|   _UserData *ud = NULL; | ||||
|   struct CDIO_STAT statbuf; | ||||
|    | ||||
|   if (CDIO_STAT (pathname, &statbuf) == -1)  | ||||
|     { | ||||
|       cdio_warn ("could not retrieve file info for `%s': %s",  | ||||
|                  pathname, strerror (errno)); | ||||
|       return NULL; | ||||
|     } | ||||
| 
 | ||||
|   ud = calloc (1, sizeof (_UserData)); | ||||
| 
 | ||||
|   ud->pathname = strdup(pathname); | ||||
|   ud->st_size  = statbuf.st_size; /* let's hope it doesn't change... */ | ||||
| 
 | ||||
|   funcs.open   = _stdio_open; | ||||
|   funcs.seek   = _stdio_seek; | ||||
|   funcs.stat   = _stdio_stat; | ||||
|   funcs.read   = _stdio_read; | ||||
|   funcs.close  = _stdio_close; | ||||
|   funcs.free   = _stdio_free; | ||||
| 
 | ||||
|   new_obj = cdio_stream_new(ud, &funcs); | ||||
| 
 | ||||
|   return new_obj; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										51
									
								
								src/libcdio/driver/_cdio_stdio.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/libcdio/driver/_cdio_stdio.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| /*
 | ||||
|   $Id: _cdio_stdio.h,v 1.3 2008/04/22 15:29:11 karl Exp $ | ||||
| 
 | ||||
|   Copyright (C) 2003, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| 
 | ||||
| #ifndef __CDIO_STDIO_H__ | ||||
| #define __CDIO_STDIO_H__ | ||||
| 
 | ||||
| #include "_cdio_stream.h" | ||||
| 
 | ||||
| /*!
 | ||||
|   Initialize a new stdio stream reading from pathname. | ||||
|   A pointer to the stream is returned or NULL if there was an error. | ||||
| 
 | ||||
|   cdio_stream_free should be called on the returned value when you | ||||
|   don't need the stream any more. No other finalization is needed. | ||||
|  */ | ||||
| CdioDataSource_t * cdio_stdio_new(const char psz_path[]); | ||||
| 
 | ||||
| /*!
 | ||||
|   Deallocate resources assocaited with obj. After this obj is unusable. | ||||
| */ | ||||
| void cdio_stdio_destroy(CdioDataSource_t *p_obj); | ||||
| 
 | ||||
| 
 | ||||
| #endif /* __CDIO_STREAM_STDIO_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										222
									
								
								src/libcdio/driver/_cdio_stream.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										222
									
								
								src/libcdio/driver/_cdio_stream.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,222 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2006, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDARG_H | ||||
| #include <stdarg.h> | ||||
| #endif | ||||
| #include "cdio_assert.h" | ||||
| 
 | ||||
| /* #define STREAM_DEBUG  */ | ||||
| 
 | ||||
| #include <cdio/logging.h> | ||||
| #include <cdio/util.h> | ||||
| #include "_cdio_stream.h" | ||||
| 
 | ||||
| static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.9 2008/04/22 15:29:11 karl Exp $"; | ||||
| 
 | ||||
| /* 
 | ||||
|  * DataSource implementations | ||||
|  */ | ||||
| 
 | ||||
| struct _CdioDataSource { | ||||
|   void* user_data; | ||||
|   cdio_stream_io_functions op; | ||||
|   int is_open; | ||||
|   off_t position; | ||||
| }; | ||||
| 
 | ||||
| void | ||||
| cdio_stream_close(CdioDataSource_t *p_obj) | ||||
| { | ||||
|   if (!p_obj) return; | ||||
| 
 | ||||
|   if (p_obj->is_open) { | ||||
|     cdio_debug ("closed source..."); | ||||
|     p_obj->op.close(p_obj->user_data); | ||||
|     p_obj->is_open  = 0; | ||||
|     p_obj->position = 0; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void | ||||
| cdio_stream_destroy(CdioDataSource_t *p_obj) | ||||
| { | ||||
|   if (!p_obj) return; | ||||
| 
 | ||||
|   cdio_stream_close(p_obj); | ||||
| 
 | ||||
|   p_obj->op.free(p_obj->user_data); | ||||
| 
 | ||||
|   free(p_obj); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|   Like 3 fgetpos. | ||||
|    | ||||
|   This function gets the current file position indicator for the stream | ||||
|   pointed to by stream.   | ||||
|    | ||||
|   @return unpon successful completion, return value is positive, else, | ||||
|   the global variable errno is set to indicate the error. | ||||
| */ | ||||
| off_t | ||||
| cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ off_t *i_offset) | ||||
| { | ||||
|   if (!p_obj || !p_obj->is_open) return DRIVER_OP_UNINIT; | ||||
|   return *i_offset = p_obj->position; | ||||
| } | ||||
| 
 | ||||
| CdioDataSource_t * | ||||
| cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs) | ||||
| { | ||||
|   CdioDataSource_t *new_obj; | ||||
| 
 | ||||
|   new_obj = calloc (1, sizeof (CdioDataSource_t)); | ||||
| 
 | ||||
|   new_obj->user_data = user_data; | ||||
|   memcpy(&(new_obj->op), funcs, sizeof(cdio_stream_io_functions)); | ||||
| 
 | ||||
|   return new_obj; | ||||
| } | ||||
| 
 | ||||
| /* 
 | ||||
|    Open if not already open.  | ||||
|    Return false if we hit an error. Errno should be set for that error. | ||||
| */ | ||||
| static bool | ||||
| _cdio_stream_open_if_necessary(CdioDataSource_t *p_obj) | ||||
| { | ||||
|   if (!p_obj) return false; | ||||
| 
 | ||||
|   if (!p_obj->is_open) { | ||||
|     if (p_obj->op.open(p_obj->user_data)) { | ||||
|       cdio_warn ("could not open input stream..."); | ||||
|       return false; | ||||
|     } else { | ||||
|       cdio_debug ("opened source..."); | ||||
|       p_obj->is_open = 1; | ||||
|       p_obj->position = 0; | ||||
|     } | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|   Like fread(3) and in fact may be the same. | ||||
|    | ||||
|   DESCRIPTION: | ||||
|   The function fread reads nmemb elements of data, each size bytes long, | ||||
|   from the stream pointed to by stream, storing them at the location | ||||
|   given by ptr. | ||||
|    | ||||
|   RETURN VALUE: | ||||
|   return the number of items successfully read or written (i.e., | ||||
|   not the number of characters).  If an error occurs, or the | ||||
|   end-of-file is reached, the return value is a short item count | ||||
|   (or zero). | ||||
|    | ||||
|   We do not distinguish between end-of-file and error, and callers | ||||
|   must use feof(3) and ferror(3) to determine which occurred. | ||||
| */ | ||||
| ssize_t | ||||
| cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t size, size_t nmemb) | ||||
| { | ||||
|   long read_bytes; | ||||
| 
 | ||||
|   if (!p_obj) return 0; | ||||
|   if (!_cdio_stream_open_if_necessary(p_obj)) return 0; | ||||
| 
 | ||||
|   read_bytes = (p_obj->op.read)(p_obj->user_data, ptr, size*nmemb); | ||||
|   p_obj->position += read_bytes; | ||||
| 
 | ||||
|   return read_bytes; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|   Like 3 fseek and in fact may be the same. | ||||
|    | ||||
|   This  function sets the file position indicator for the stream | ||||
|   pointed to by stream.  The new position, measured in bytes, is obtained | ||||
|   by  adding offset bytes to the position specified by whence.  If whence | ||||
|   is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset  is  relative  to | ||||
|   the  start of the file, the current position indicator, or end-of-file, | ||||
|   respectively.  A successful call to the fseek function clears the end- | ||||
|   of-file indicator for the stream and undoes any effects of the | ||||
|   ungetc(3) function on the same stream. | ||||
|    | ||||
|   @return unpon successful completion, return value is positive, else, | ||||
|   the global variable errno is set to indicate the error. | ||||
| */ | ||||
| int | ||||
| cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence) | ||||
| { | ||||
|   if (!p_obj) return DRIVER_OP_UNINIT; | ||||
| 
 | ||||
|   if (!_cdio_stream_open_if_necessary(p_obj))  | ||||
|     /* errno is set by _cdio_stream_open_if necessary. */ | ||||
|     return DRIVER_OP_ERROR; | ||||
| 
 | ||||
|   if (offset < 0) return DRIVER_OP_ERROR; | ||||
|   if (p_obj->position < 0) return DRIVER_OP_ERROR; | ||||
| 
 | ||||
|   if (p_obj->position != offset) { | ||||
| #ifdef STREAM_DEBUG | ||||
|     cdio_warn("had to reposition DataSource from %ld to %ld!", p_obj->position, offset); | ||||
| #endif | ||||
|     p_obj->position = offset; | ||||
|     return p_obj->op.seek(p_obj->user_data, offset, whence); | ||||
|   } | ||||
| 
 | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|   Return whatever size of stream reports, I guess unit size is bytes.  | ||||
|   On error return -1; | ||||
|  */ | ||||
| off_t | ||||
| cdio_stream_stat(CdioDataSource_t *p_obj) | ||||
| { | ||||
|   if (!p_obj) return -1; | ||||
|   if (!_cdio_stream_open_if_necessary(p_obj)) return -1; | ||||
| 
 | ||||
|   return p_obj->op.stat(p_obj->user_data); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										139
									
								
								src/libcdio/driver/_cdio_stream.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								src/libcdio/driver/_cdio_stream.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,139 @@ | |||
| /*
 | ||||
|   $Id: _cdio_stream.h,v 1.5 2008/04/22 15:29:11 karl Exp $ | ||||
| 
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| 
 | ||||
| #ifndef __CDIO_STREAM_H__ | ||||
| #define __CDIO_STREAM_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| #include "cdio_private.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /* typedef'ed IO functions prototypes */ | ||||
|    | ||||
|   typedef int(*cdio_data_open_t)(void *user_data); | ||||
|    | ||||
|   typedef ssize_t(*cdio_data_read_t)(void *user_data, void *buf, size_t count); | ||||
|    | ||||
|   typedef int(*cdio_data_seek_t)(void *user_data, off_t offset, | ||||
|                                                   int whence); | ||||
|    | ||||
|   typedef off_t(*cdio_data_stat_t)(void *user_data); | ||||
|    | ||||
|   typedef int(*cdio_data_close_t)(void *user_data); | ||||
|    | ||||
|   typedef void(*cdio_data_free_t)(void *user_data); | ||||
|    | ||||
|    | ||||
|   /* abstract data source */ | ||||
|    | ||||
|   typedef struct { | ||||
|     cdio_data_open_t open; | ||||
|     cdio_data_seek_t seek;  | ||||
|     cdio_data_stat_t stat;  | ||||
|     cdio_data_read_t read; | ||||
|     cdio_data_close_t close; | ||||
|     cdio_data_free_t free; | ||||
|   } cdio_stream_io_functions; | ||||
|    | ||||
|   /**
 | ||||
|      Like 3 fgetpos. | ||||
|       | ||||
|      This function gets the current file position indicator for the stream | ||||
|      pointed to by stream.   | ||||
|       | ||||
|      @return unpon successful completion, return value is positive, else, | ||||
|      the global variable errno is set to indicate the error. | ||||
|   */ | ||||
|   off_t cdio_stream_getpos(CdioDataSource_t* p_obj,  | ||||
|                              /*out*/ off_t *i_offset); | ||||
|    | ||||
|   CdioDataSource_t * | ||||
|   cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs); | ||||
| 
 | ||||
|   /**
 | ||||
|      Like fread(3) and in fact may be the same. | ||||
| 
 | ||||
|      DESCRIPTION: | ||||
|      The function fread reads nmemb elements of data, each size bytes long, | ||||
|      from the stream pointed to by stream, storing them at the location | ||||
|      given by ptr. | ||||
| 
 | ||||
|      RETURN VALUE: | ||||
|      return the number of items successfully read or written (i.e., | ||||
|      not the number of characters).  If an error occurs, or the | ||||
|      end-of-file is reached, the return value is a short item count | ||||
|      (or zero). | ||||
| 
 | ||||
|      We do not distinguish between end-of-file and error, and callers | ||||
|      must use feof(3) and ferror(3) to determine which occurred. | ||||
|   */ | ||||
|   ssize_t cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t i_size,  | ||||
|                            size_t nmemb); | ||||
|    | ||||
|   /** 
 | ||||
|     Like fseek(3)/fseeko(3) and in fact may be the same. | ||||
| 
 | ||||
|     This  function sets the file position indicator for the stream | ||||
|     pointed to by stream.  The new position, measured in bytes, is obtained | ||||
|     by  adding offset bytes to the position specified by whence.  If whence | ||||
|     is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset  is  relative  to | ||||
|     the  start of the file, the current position indicator, or end-of-file, | ||||
|     respectively.  A successful call to the fseek function clears the end- | ||||
|     of-file indicator for the stream and undoes any effects of the | ||||
|     ungetc(3) function on the same stream. | ||||
|      | ||||
|     @return upon successful completion, DRIVER_OP_SUCCESS, else, | ||||
|     DRIVER_OP_ERROR is returned and the global variable errno is set to | ||||
|     indicate the error. | ||||
|    */ | ||||
|   int cdio_stream_seek(CdioDataSource_t *p_obj, off_t i_offset,  | ||||
|                            int whence); | ||||
|    | ||||
|   /**
 | ||||
|     Return whatever size of stream reports, I guess unit size is bytes.  | ||||
|     On error return -1; | ||||
|   */ | ||||
|   off_t cdio_stream_stat(CdioDataSource_t *p_obj); | ||||
|    | ||||
|   /**
 | ||||
|     Deallocate resources associated with p_obj. After this p_obj is unusable. | ||||
|   */ | ||||
|   void cdio_stream_destroy(CdioDataSource_t *p_obj); | ||||
|    | ||||
|   void cdio_stream_close(CdioDataSource_t *p_obj); | ||||
|    | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_STREAM_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										58
									
								
								src/libcdio/driver/cdio_assert.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/libcdio/driver/cdio_assert.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | |||
| /*
 | ||||
|   Copyright (C) 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifndef __CDIO_ASSERT_H__ | ||||
| #define __CDIO_ASSERT_H__ | ||||
| 
 | ||||
| #if defined(__GNUC__) && !defined(__MINGW32__) | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/logging.h> | ||||
| 
 | ||||
| #define cdio_assert(expr) \ | ||||
|  { \ | ||||
|    if (GNUC_UNLIKELY (!(expr))) cdio_log (CDIO_LOG_ASSERT, \ | ||||
|      "file %s: line %d (%s): assertion failed: (%s)", \ | ||||
|      __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ | ||||
|  } | ||||
| 
 | ||||
| #define cdio_assert_not_reached() \ | ||||
|  { \ | ||||
|    cdio_log (CDIO_LOG_ASSERT, \ | ||||
|      "file %s: line %d (%s): should not be reached", \ | ||||
|      __FILE__, __LINE__, __PRETTY_FUNCTION__); \ | ||||
|  } | ||||
| 
 | ||||
| #else /* non GNU C or MinGW */ | ||||
| 
 | ||||
| #include <assert.h> | ||||
| 
 | ||||
| #define cdio_assert(expr) \ | ||||
|  assert(expr) | ||||
| 
 | ||||
| #define cdio_assert_not_reached() \ | ||||
|  assert(0) | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __CDIO_ASSERT_H__ */ | ||||
							
								
								
									
										562
									
								
								src/libcdio/driver/cdio_private.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										562
									
								
								src/libcdio/driver/cdio_private.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,562 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2009, 2011 | ||||
|   Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /* Internal routines for CD I/O drivers. */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_PRIVATE_H__ | ||||
| #define __CDIO_PRIVATE_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) | ||||
| # include "config.h" | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/audio.h> | ||||
| #include <cdio/cdtext.h> | ||||
| //#include "mmc/mmc_private.h"
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   extern const char * cdio_dirname(const char *fname); | ||||
|   extern const char *cdio_abspath(const char *cwd, const char *fname); | ||||
| 
 | ||||
|   /* Opaque type */ | ||||
|   typedef struct _CdioDataSource CdioDataSource_t; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| 
 | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #include "generic.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| 
 | ||||
|   typedef struct { | ||||
|      | ||||
|     /*!
 | ||||
|       Get volume of an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_get_volume)  | ||||
| 	 (void *p_env,  /*out*/ cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Pause playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_pause) (void *p_env); | ||||
|      | ||||
|     /*!
 | ||||
|       Playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_play_msf) ( void *p_env,  | ||||
| 					     msf_t *p_start_msf, | ||||
| 					     msf_t *p_end_msf ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_play_track_index)  | ||||
| 	 ( void *p_env, cdio_track_index_t *p_track_index ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Get subchannel information. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_read_subchannel)  | ||||
| 	 ( void *p_env, cdio_subchannel_t *subchannel ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Resume playing an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_resume) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Set volume of an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_set_volume)  | ||||
| 	 ( void *p_env,  cdio_audio_volume_t *p_volume ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Stop playing an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_stop) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Eject media in CD drive. If successful, as a side effect we  | ||||
|       also free p_env.  | ||||
| 
 | ||||
|       @param p_env the CD object to be acted upon. | ||||
|       If the CD is ejected *p_env is freed and p_env set to NULL. | ||||
|     */ | ||||
|     driver_return_code_t (*eject_media) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Release and free resources associated with cd.  | ||||
|     */ | ||||
|     void (*free) (void *p_env); | ||||
|      | ||||
|     /*!
 | ||||
|       Return the value associated with the key "arg". | ||||
|     */ | ||||
|     const char * (*get_arg) (void *p_env, const char key[]); | ||||
|      | ||||
|     /*!
 | ||||
|       Get the block size for subsequest read requests, via a SCSI MMC  | ||||
|       MODE_SENSE 6 command. | ||||
|     */ | ||||
|     int (*get_blocksize) ( void *p_env ); | ||||
|      | ||||
|     /*! 
 | ||||
|       Get cdtext information for a CdIo object. | ||||
|      | ||||
|       @param obj the CD object that may contain CD-TEXT information. | ||||
|       @return the CD-TEXT object or NULL if obj is NULL | ||||
|       or CD-TEXT information does not exist. | ||||
|     */ | ||||
|     cdtext_t * (*get_cdtext) ( void *p_env ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Get raw cdtext information as on the disc for a CdIo object | ||||
| 
 | ||||
|       @param obj the CD object that may contain CD-TEXT information. | ||||
|       @return pointer to the raw CD-TEXT data or NULL if obj is NULL | ||||
|       or no CD-TEXT information present on the disc. | ||||
| 
 | ||||
|       free when done and not NULL. | ||||
|     */ | ||||
|     uint8_t * (*get_cdtext_raw) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return an array of device names. if CdIo is NULL (we haven't | ||||
|       initialized a specific device driver), then find a suitable device  | ||||
|       driver. | ||||
|        | ||||
|       NULL is returned if we couldn't return a list of devices. | ||||
|     */ | ||||
|     char ** (*get_devices) ( void ); | ||||
|      | ||||
|     /*!
 | ||||
|       Get the default CD device. | ||||
| 
 | ||||
|       @return a string containing the default CD device or NULL is | ||||
|       if we couldn't get a default device. | ||||
| 
 | ||||
|       In some situations of drivers or OS's we can't find a CD device if | ||||
|       there is no media in it and it is possible for this routine to return | ||||
|       NULL even though there may be a hardware CD-ROM. | ||||
|     */ | ||||
|     char * (*get_default_device) ( void ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return the size of the CD in logical block address (LBA) units. | ||||
|       @return the lsn. On error 0 or CDIO_INVALD_LSN. | ||||
|     */ | ||||
|     lsn_t (*get_disc_last_lsn) ( void *p_env ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Get disc mode associated with cd_obj. | ||||
|     */ | ||||
|     discmode_t (*get_discmode) ( void *p_env ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Return the what kind of device we've got. | ||||
|        | ||||
|       See cd_types.h for a list of bitmasks for the drive type; | ||||
|     */ | ||||
|     void (*get_drive_cap) (const void *p_env, | ||||
| 			   cdio_drive_read_cap_t  *p_read_cap, | ||||
| 			   cdio_drive_write_cap_t *p_write_cap, | ||||
| 			   cdio_drive_misc_cap_t  *p_misc_cap); | ||||
|     /*!
 | ||||
|       Return the number of of the first track.  | ||||
|       CDIO_INVALID_TRACK is returned on error. | ||||
|     */ | ||||
|     track_t (*get_first_track_num) ( void *p_env ); | ||||
|      | ||||
|     /*! 
 | ||||
|       Get the CD-ROM hardware info via a SCSI MMC INQUIRY command. | ||||
|       False is returned if we had an error getting the information. | ||||
|     */ | ||||
|     bool (*get_hwinfo)  | ||||
| 	 ( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info ); | ||||
| 
 | ||||
|     /*! Get the LSN of the first track of the last session of
 | ||||
|       on the CD. | ||||
| 	    | ||||
|        @param p_cdio the CD object to be acted upon. | ||||
|        @param i_last_session pointer to the session number to be returned. | ||||
|     */ | ||||
|     driver_return_code_t (*get_last_session) | ||||
| 	 ( void *p_env, /*out*/ lsn_t *i_last_session ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Find out if media has changed since the last call. | ||||
|       @param p_env the CD object to be acted upon. | ||||
|       @return 1 if media has changed since last call, 0 if not. Error | ||||
|       return codes are the same as driver_return_code_t | ||||
|     */ | ||||
|     int (*get_media_changed) ( const void *p_env ); | ||||
| 
 | ||||
|     /*!  
 | ||||
|       Return the media catalog number MCN from the CD or NULL if | ||||
|       there is none or we don't have the ability to get it. | ||||
|     */ | ||||
|     char * (*get_mcn) ( const void *p_env ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Return the number of tracks in the current medium. | ||||
|       CDIO_INVALID_TRACK is returned on error. | ||||
|     */ | ||||
|     track_t (*get_num_tracks) ( void *p_env ); | ||||
|      | ||||
|     /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|       implemented or -1 for error. | ||||
|       Not meaningful if track is not an audio track. | ||||
|     */ | ||||
|     int (*get_track_channels) ( const void *p_env, track_t i_track ); | ||||
|    | ||||
|     /*! Return 0 if track is copy protected, 1 if not, or -1 for error
 | ||||
|       or -2 if not implimented (yet). Is this meaningful if not an | ||||
|       audio track? | ||||
|     */ | ||||
|     track_flag_t (*get_track_copy_permit) ( void *p_env, track_t i_track ); | ||||
|    | ||||
|     /*!  
 | ||||
|       Return the starting LBA for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       The "leadout" track is specified either by | ||||
|       using track_num LEADOUT_TRACK or the total tracks+1. | ||||
|       CDIO_INVALID_LBA is returned on error. | ||||
|     */ | ||||
|     lba_t (*get_track_lba) ( void *p_env, track_t i_track ); | ||||
| 
 | ||||
|     /*!  
 | ||||
|       Return the starting LBA for the pregap for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       CDIO_INVALID_LBA is returned on error. | ||||
|     */ | ||||
|     lba_t (*get_track_pregap_lba) ( const void *p_env, track_t i_track ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Return the International Standard Recording Code (ISRC) for track number | ||||
|       i_track in p_cdio.  Track numbers start at 1. | ||||
| 
 | ||||
|       Note: string is malloc'd so caller has to free() the returned | ||||
|       string when done with it. | ||||
|     */ | ||||
|     char * (*get_track_isrc) ( const void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!  
 | ||||
|       Get format of track.  | ||||
|     */ | ||||
|     track_format_t (*get_track_format) ( void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return true if we have XA data (green, mode2 form1) or | ||||
|       XA data (green, mode2 form2). That is track begins: | ||||
|       sync - header - subheader | ||||
|       12     4      -  8 | ||||
|        | ||||
|       FIXME: there's gotta be a better design for this and get_track_format? | ||||
|     */ | ||||
|     bool (*get_track_green) ( void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!  
 | ||||
|       Return the starting MSF (minutes/secs/frames) for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       The "leadout" track is specified either by | ||||
|       using i_track LEADOUT_TRACK or the total tracks+1. | ||||
|       False is returned on error. | ||||
|     */ | ||||
|     bool (*get_track_msf) ( void *p_env, track_t i_track, msf_t *p_msf ); | ||||
|      | ||||
|     /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error
 | ||||
|       or -2 if not implimented (yet). Is this meaningful if not an | ||||
|       audio track? | ||||
|     */ | ||||
|     track_flag_t (*get_track_preemphasis)  | ||||
| 	 ( const void  *p_env, track_t i_track ); | ||||
|    | ||||
|     /*!
 | ||||
|       lseek - reposition read/write file offset | ||||
|       Returns (off_t) -1 on error.  | ||||
|       Similar to libc's lseek() | ||||
|     */ | ||||
|     off_t (*lseek) ( void *p_env, off_t offset, int whence ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads into buf the next size bytes. | ||||
|       Returns -1 on error.  | ||||
|       Similar to libc's read() | ||||
|     */ | ||||
|     ssize_t (*read) ( void *p_env, void *p_buf, size_t i_size ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode2 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn, | ||||
| 				unsigned int i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Read a data sector | ||||
|        | ||||
|       @param p_env environment to read from | ||||
| 
 | ||||
|       @param p_buf place to read data into.  The caller should make sure | ||||
|       this location can store at least CDIO_CD_FRAMESIZE,  | ||||
|       M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending | ||||
|       on the kind of sector getting read. If you don't  | ||||
|       know whether you have a Mode 1/2, Form 1/ Form 2/Formless | ||||
|       sector best to reserve space for the maximum,  | ||||
|       M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|       @param i_lsn sector to read | ||||
|       @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,  | ||||
|       M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. | ||||
|     */ | ||||
|     driver_return_code_t (*read_data_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize, | ||||
| 	   uint32_t i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode2 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode2_sector)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads i_blocks of mode2 sectors from cd device into data starting | ||||
|       from lsn. | ||||
|       Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode2_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2,  | ||||
| 	   unsigned int i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode1 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode1_sector)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads i_blocks of mode1 sectors from cd device into data starting | ||||
|       from lsn. | ||||
|       Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode1_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2,  | ||||
| 	   unsigned int i_blocks ); | ||||
|      | ||||
|     bool (*read_toc) ( void *p_env ) ; | ||||
| 
 | ||||
|     /*!
 | ||||
|       Run a SCSI MMC command.  | ||||
|        | ||||
|       cdio	        CD structure set by cdio_open(). | ||||
|       i_timeout_ms      time in milliseconds we will wait for the command | ||||
|                         to complete.  | ||||
|       cdb_len           number of bytes in cdb (6, 10, or 12). | ||||
|       cdb	        CDB bytes. All values that are needed should be set on  | ||||
|                         input.  | ||||
|       b_return_data	TRUE if the command expects data to be returned in  | ||||
|                         the buffer | ||||
|       len	        Size of buffer | ||||
|       buf	        Buffer for data, both sending and receiving | ||||
|        | ||||
|       Returns 0 if command completed successfully. | ||||
|     */ | ||||
| //    mmc_run_cmd_fn_t run_mmc_cmd;
 | ||||
| 
 | ||||
|     /*!
 | ||||
|       Set the arg "key" with "value" in the source device. | ||||
|     */ | ||||
|     int (*set_arg) ( void *p_env, const char key[], const char value[] ); | ||||
|      | ||||
|     /*!
 | ||||
|       Set the blocksize for subsequent reads.  | ||||
|     */ | ||||
|     driver_return_code_t (*set_blocksize) ( void *p_env,  | ||||
| 					    uint16_t i_blocksize ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Set the drive speed.  | ||||
|        | ||||
|       @return 0 if everything went okay, -1 if we had an error. is -2 | ||||
|       returned if this is not implemented for the current driver. | ||||
|     */ | ||||
|     int (*set_speed) ( void *p_env, int i_speed ); | ||||
| 
 | ||||
|   } cdio_funcs_t; | ||||
| 
 | ||||
| 
 | ||||
|   /*! Implementation of CdIo type */ | ||||
|   struct _CdIo { | ||||
|     driver_id_t driver_id; /**< Particular driver opened. */ | ||||
|     cdio_funcs_t op;       /**< driver-specific routines handling
 | ||||
| 			        implementation*/ | ||||
|     void *env;             /**< environment. Passed to routine above. */ | ||||
|   }; | ||||
| 
 | ||||
|   /* This is used in drivers that must keep their own internal 
 | ||||
|      position pointer for doing seeks. Stream-based drivers (like bincue, | ||||
|      nrg, toc, network) would use this.  | ||||
|    */ | ||||
|   typedef struct  | ||||
|   { | ||||
|     off_t   buff_offset;      /* buffer offset in disk-image seeks. */ | ||||
|     track_t index;            /* Current track index in tocent. */ | ||||
|     lba_t   lba;              /* Current LBA */ | ||||
|   } internal_position_t; | ||||
|    | ||||
|   CdIo_t * cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs); | ||||
| 
 | ||||
|   /* The below structure describes a specific CD Input driver  */ | ||||
|   typedef struct  | ||||
|   { | ||||
|     driver_id_t  id; | ||||
|     unsigned int flags; | ||||
|     const char  *name; | ||||
|     const char  *describe; | ||||
|     bool (*have_driver) (void);  | ||||
|     CdIo_t *(*driver_open) (const char *psz_source_name);  | ||||
|     CdIo_t *(*driver_open_am) (const char *psz_source_name,  | ||||
| 			     const char *psz_access_mode);  | ||||
|     char *(*get_default_device) (void);  | ||||
|     bool (*is_device) (const char *psz_source_name); | ||||
|     char **(*get_devices) (void); | ||||
|     driver_return_code_t (*close_tray) (const char *psz_device); | ||||
|   } CdIo_driver_t; | ||||
| 
 | ||||
|   /* The below array gives of the drivers that are currently available for 
 | ||||
|      on a particular host. */ | ||||
|   extern CdIo_driver_t CdIo_driver[]; | ||||
| 
 | ||||
|   /* The last valid entry of Cdio_driver. -1 means uninitialzed. -2 
 | ||||
|      means some sort of error. | ||||
|    */ | ||||
|   extern int CdIo_last_driver;  | ||||
| 
 | ||||
|   /* The below array gives all drivers that can possibly appear.
 | ||||
|      on a particular host. */ | ||||
|   extern CdIo_driver_t CdIo_all_drivers[]; | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Add/allocate a drive to the end of drives.  | ||||
|     Use cdio_free_device_list() to free this device_list. | ||||
|   */ | ||||
|   void cdio_add_device_list(char **device_list[], const char *psz_drive, | ||||
| 			    unsigned int *i_drives); | ||||
| 
 | ||||
|   driver_return_code_t close_tray_bsdi    (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_freebsd (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_linux   (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_netbsd  (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_os2     (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_osx     (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_solaris (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_win32   (const char *psz_drive); | ||||
| 
 | ||||
|   bool cdio_have_netbsd(void); | ||||
|   CdIo_t * cdio_open_netbsd (const char *psz_source); | ||||
|   char * cdio_get_default_device_netbsd(void); | ||||
|   char **cdio_get_devices_netbsd(void); | ||||
|   /*! Set up CD-ROM for reading using the NetBSD driver. The device_name is
 | ||||
|       the some sort of device name. | ||||
| 
 | ||||
|      NULL is returned on error or there is no FreeBSD driver. | ||||
| 
 | ||||
|      @see cdio_open_cd, cdio_open | ||||
|    */ | ||||
|   CdIo_t * cdio_open_am_netbsd (const char *psz_source, | ||||
| 				const char *psz_access_mode); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if AIX driver is available. */ | ||||
|   bool cdio_have_aix    (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if BSDI driver is available. */ | ||||
|   bool cdio_have_bsdi    (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if FreeBSD driver is available. */ | ||||
|   bool cdio_have_freebsd (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if GNU/Linux driver is available. */ | ||||
|   bool cdio_have_linux   (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if Sun Solaris driver is available. */ | ||||
|   bool cdio_have_solaris (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if IBM OS2 driver is available. */ | ||||
|   bool cdio_have_os2     (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if Apple OSX driver is available. */ | ||||
|   bool cdio_have_osx     (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if Microsoft Windows driver is available. */ | ||||
|   bool cdio_have_win32   (void); | ||||
| 
 | ||||
|   /*! True if Nero driver is available. */ | ||||
|   bool cdio_have_nrg     (void); | ||||
| 
 | ||||
|   /*! True if BIN/CUE driver is available. */ | ||||
|   bool cdio_have_bincue  (void); | ||||
| 
 | ||||
|   /*! True if cdrdao CDRDAO driver is available. */ | ||||
|   bool cdio_have_cdrdao  (void); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_PRIVATE_H__ */ | ||||
							
								
								
									
										164
									
								
								src/libcdio/driver/disc.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								src/libcdio/driver/disc.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,164 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2011 | ||||
|    Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| 
 | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include "cdio_private.h" | ||||
| 
 | ||||
| /* Must match discmode enumeration */ | ||||
| const char *discmode2str[] = { | ||||
|   "CD-DA",  | ||||
|   "CD-DATA (Mode 1)",  | ||||
|   "CD DATA (Mode 2)",  | ||||
|   "CD-ROM Mixed", | ||||
|   "DVD-ROM",  | ||||
|   "DVD-RAM",  | ||||
|   "DVD-R",  | ||||
|   "DVD-RW",  | ||||
|   "HD DVD ROM", | ||||
|   "HD_DVD RAM",  | ||||
|   "HD DVD-R",  | ||||
|   "DVD+R", | ||||
|   "DVD+RW",  | ||||
|   "DVD+RW DL",  | ||||
|   "DVD+R DL",  | ||||
|   "Unknown/unclassified DVD",  | ||||
|   "No information", | ||||
|   "Error in getting information", | ||||
|   "CD-i"  | ||||
| }; | ||||
| 
 | ||||
| /*! 
 | ||||
|   Get cdtext information for a CdIo object . | ||||
|    | ||||
|   @param obj the CD object that may contain CD-TEXT information. | ||||
|   @return the CD-TEXT object or NULL if obj is NULL | ||||
|   or CD-TEXT information does not exist. | ||||
| */ | ||||
| cdtext_t * | ||||
| cdio_get_cdtext (CdIo *obj) | ||||
| { | ||||
|   if (obj == NULL) return NULL; | ||||
|    | ||||
|   if (NULL != obj->op.get_cdtext) { | ||||
|     return obj->op.get_cdtext (obj->env); | ||||
|   } else { | ||||
|     return NULL; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Get binary cdtext information for a CdIo object . | ||||
|    | ||||
|   @param obj the CD object that may contain CD-TEXT information. | ||||
|   @return pointer to allocated memory area holding the raw CD-TEXT | ||||
|   or NULL if obj is NULL or CD-TEXT does not exist. | ||||
|   free() when done. | ||||
| */ | ||||
| uint8_t * | ||||
| cdio_get_cdtext_raw (CdIo *obj) | ||||
| { | ||||
|   if (obj == NULL) return NULL; | ||||
| 
 | ||||
|   if (NULL != obj->op.get_cdtext_raw) { | ||||
|     return obj->op.get_cdtext_raw (obj->env); | ||||
|   } else { | ||||
|     return NULL; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Get the size of the CD in logical block address (LBA) units. | ||||
|    | ||||
|   @param p_cdio the CD object queried | ||||
|   @return the lsn. On error 0 or CDIO_INVALD_LSN. | ||||
| */ | ||||
| lsn_t  | ||||
| cdio_get_disc_last_lsn(const CdIo_t *p_cdio) | ||||
| { | ||||
|   if (!p_cdio) return CDIO_INVALID_LSN; | ||||
|   return p_cdio->op.get_disc_last_lsn (p_cdio->env); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Get medium associated with cd_obj. | ||||
| */ | ||||
| discmode_t | ||||
| cdio_get_discmode (CdIo_t *cd_obj) | ||||
| { | ||||
|   if (!cd_obj) return CDIO_DISC_MODE_ERROR; | ||||
|    | ||||
|   if (cd_obj->op.get_discmode) { | ||||
|     return cd_obj->op.get_discmode (cd_obj->env); | ||||
|   } else { | ||||
|     return CDIO_DISC_MODE_NO_INFO; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return a string containing the name of the driver in use. | ||||
|   if CdIo is NULL (we haven't initialized a specific device driver),  | ||||
|   then return NULL. | ||||
| */ | ||||
| char * | ||||
| cdio_get_mcn (const CdIo_t *p_cdio)  | ||||
| { | ||||
|   if (p_cdio->op.get_mcn) { | ||||
|     return p_cdio->op.get_mcn (p_cdio->env); | ||||
|   } else { | ||||
|     return NULL; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool | ||||
| cdio_is_discmode_cdrom(discmode_t discmode)  | ||||
| { | ||||
|   switch (discmode) { | ||||
|   case CDIO_DISC_MODE_CD_DA: | ||||
|   case CDIO_DISC_MODE_CD_DATA: | ||||
|   case CDIO_DISC_MODE_CD_XA: | ||||
|   case CDIO_DISC_MODE_CD_MIXED: | ||||
|   case CDIO_DISC_MODE_NO_INFO: | ||||
|     return true; | ||||
|   default: | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool | ||||
| cdio_is_discmode_dvd(discmode_t discmode)  | ||||
| { | ||||
|   switch (discmode) { | ||||
|     case CDIO_DISC_MODE_DVD_ROM: | ||||
|     case CDIO_DISC_MODE_DVD_RAM: | ||||
|     case CDIO_DISC_MODE_DVD_R: | ||||
|     case CDIO_DISC_MODE_DVD_RW: | ||||
|     case CDIO_DISC_MODE_DVD_PR: | ||||
|     case CDIO_DISC_MODE_DVD_PRW: | ||||
|     case CDIO_DISC_MODE_DVD_OTHER: | ||||
|       return true; | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										254
									
								
								src/libcdio/driver/ds.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										254
									
								
								src/libcdio/driver/ds.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,254 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/ds.h> | ||||
| #include <cdio/util.h> | ||||
| #include <cdio/types.h> | ||||
| #include "cdio_assert.h" | ||||
| 
 | ||||
| static const char _rcsid[] = "$Id: ds.c,v 1.4 2008/04/22 15:29:12 karl Exp $"; | ||||
| 
 | ||||
| struct _CdioList | ||||
| { | ||||
|   unsigned length; | ||||
| 
 | ||||
|   CdioListNode_t *begin; | ||||
|   CdioListNode_t *end; | ||||
| }; | ||||
| 
 | ||||
| struct _CdioListNode | ||||
| { | ||||
|   CdioList_t *list; | ||||
| 
 | ||||
|   CdioListNode_t *next; | ||||
| 
 | ||||
|   void *data; | ||||
| }; | ||||
| 
 | ||||
| /* impl */ | ||||
| 
 | ||||
| CdioList_t * | ||||
| _cdio_list_new (void) | ||||
| { | ||||
|   CdioList_t *p_new_obj = calloc (1, sizeof (CdioList_t)); | ||||
| 
 | ||||
|   return p_new_obj; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| _cdio_list_free (CdioList_t *p_list, int free_data) | ||||
| { | ||||
|   while (_cdio_list_length (p_list)) | ||||
|     _cdio_list_node_free (_cdio_list_begin (p_list), free_data); | ||||
| 
 | ||||
|   free (p_list); | ||||
| } | ||||
| 
 | ||||
| unsigned | ||||
| _cdio_list_length (const CdioList_t *p_list) | ||||
| { | ||||
|   cdio_assert (p_list != NULL); | ||||
| 
 | ||||
|   return p_list->length; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| _cdio_list_prepend (CdioList_t *p_list, void *p_data) | ||||
| { | ||||
|   CdioListNode_t *p_new_node; | ||||
| 
 | ||||
|   cdio_assert (p_list != NULL); | ||||
| 
 | ||||
|   p_new_node = calloc (1, sizeof (CdioListNode_t)); | ||||
|    | ||||
|   p_new_node->list = p_list; | ||||
|   p_new_node->next = p_list->begin; | ||||
|   p_new_node->data = p_data; | ||||
| 
 | ||||
|   p_list->begin = p_new_node; | ||||
|   if (p_list->length == 0) | ||||
|     p_list->end = p_new_node; | ||||
| 
 | ||||
|   p_list->length++; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| _cdio_list_append (CdioList_t *p_list, void *p_data) | ||||
| { | ||||
|   cdio_assert (p_list != NULL); | ||||
| 
 | ||||
|   if (p_list->length == 0) | ||||
|     { | ||||
|       _cdio_list_prepend (p_list, p_data); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       CdioListNode_t *p_new_node = calloc (1, sizeof (CdioListNode_t)); | ||||
|        | ||||
|       p_new_node->list = p_list; | ||||
|       p_new_node->next = NULL; | ||||
|       p_new_node->data = p_data; | ||||
| 
 | ||||
|       p_list->end->next = p_new_node; | ||||
|       p_list->end = p_new_node; | ||||
| 
 | ||||
|       p_list->length++; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void  | ||||
| _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func,  | ||||
|                     void *p_user_data) | ||||
| { | ||||
|   CdioListNode_t *node; | ||||
| 
 | ||||
|   cdio_assert (p_list != NULL); | ||||
|   cdio_assert (func != 0); | ||||
|    | ||||
|   for (node = _cdio_list_begin (p_list); | ||||
|        node != NULL; | ||||
|        node = _cdio_list_node_next (node)) | ||||
|     func (_cdio_list_node_data (node), p_user_data); | ||||
| } | ||||
| 
 | ||||
| CdioListNode_t * | ||||
| _cdio_list_find (CdioList_t *p_list, _cdio_list_iterfunc_t cmp_func,  | ||||
|                  void *p_user_data) | ||||
| { | ||||
|   CdioListNode_t *p_node; | ||||
| 
 | ||||
|   cdio_assert (p_list != NULL); | ||||
|   cdio_assert (cmp_func != 0); | ||||
|    | ||||
|   for (p_node = _cdio_list_begin (p_list); | ||||
|        p_node != NULL; | ||||
|        p_node = _cdio_list_node_next (p_node)) | ||||
|     if (cmp_func (_cdio_list_node_data (p_node), p_user_data)) | ||||
|       break; | ||||
| 
 | ||||
|   return p_node; | ||||
| } | ||||
| 
 | ||||
| CdioListNode_t * | ||||
| _cdio_list_begin (const CdioList_t *p_list) | ||||
| { | ||||
|   cdio_assert (p_list != NULL); | ||||
| 
 | ||||
|   return p_list->begin; | ||||
| } | ||||
| 
 | ||||
| CdioListNode_t * | ||||
| _cdio_list_end (CdioList_t *p_list) | ||||
| { | ||||
|   cdio_assert (p_list != NULL); | ||||
| 
 | ||||
|   return p_list->end; | ||||
| } | ||||
| 
 | ||||
| CdioListNode_t * | ||||
| _cdio_list_node_next (CdioListNode_t *p_node) | ||||
| { | ||||
|   if (p_node) | ||||
|     return p_node->next; | ||||
| 
 | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| void  | ||||
| _cdio_list_node_free (CdioListNode_t *p_node, int free_data) | ||||
| { | ||||
|   CdioList_t *p_list; | ||||
|   CdioListNode_t *prev_node; | ||||
| 
 | ||||
|   cdio_assert (p_node != NULL); | ||||
|    | ||||
|   p_list = p_node->list; | ||||
| 
 | ||||
|   cdio_assert (_cdio_list_length (p_list) > 0); | ||||
| 
 | ||||
|   if (free_data) | ||||
|     free (_cdio_list_node_data (p_node)); | ||||
| 
 | ||||
|   if (_cdio_list_length (p_list) == 1) | ||||
|     { | ||||
|       cdio_assert (p_list->begin == p_list->end); | ||||
| 
 | ||||
|       p_list->end = p_list->begin = NULL; | ||||
|       p_list->length = 0; | ||||
|       free (p_node); | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|   cdio_assert (p_list->begin != p_list->end); | ||||
| 
 | ||||
|   if (p_list->begin == p_node) | ||||
|     { | ||||
|       p_list->begin = p_node->next; | ||||
|       free (p_node); | ||||
|       p_list->length--; | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|   for (prev_node = p_list->begin; prev_node->next; prev_node = prev_node->next) | ||||
|     if (prev_node->next == p_node) | ||||
|       break; | ||||
| 
 | ||||
|   cdio_assert (prev_node->next != NULL); | ||||
| 
 | ||||
|   if (p_list->end == p_node) | ||||
|     p_list->end = prev_node; | ||||
| 
 | ||||
|   prev_node->next = p_node->next; | ||||
| 
 | ||||
|   p_list->length--; | ||||
| 
 | ||||
|   free (p_node); | ||||
| } | ||||
| 
 | ||||
| void * | ||||
| _cdio_list_node_data (CdioListNode_t *p_node) | ||||
| { | ||||
|   if (p_node) | ||||
|     return p_node->data; | ||||
| 
 | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| /* eof */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
| 
 | ||||
							
								
								
									
										134
									
								
								src/libcdio/driver/filemode.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								src/libcdio/driver/filemode.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,134 @@ | |||
| /*
 | ||||
|   filemode.h -- file modes common definitions | ||||
| 
 | ||||
|   Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc. | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| #ifndef __FILEMODE_H__ | ||||
| #define __FILEMODE_H__ | ||||
| 
 | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| #include <sys/stat.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifndef S_IRUSR | ||||
| # ifdef S_IREAD | ||||
| #  define S_IRUSR S_IREAD | ||||
| # else | ||||
| #  define S_IRUSR 00400 | ||||
| # endif | ||||
| #endif | ||||
| 
 | ||||
| #ifndef S_IWUSR | ||||
| # ifdef S_IWRITE | ||||
| #  define S_IWUSR S_IWRITE | ||||
| # else | ||||
| #  define S_IWUSR 00200 | ||||
| # endif | ||||
| #endif | ||||
| 
 | ||||
| #ifndef S_IXUSR | ||||
| # ifdef S_IEXEC | ||||
| #  define S_IXUSR S_IEXEC | ||||
| # else | ||||
| #  define S_IXUSR 00100 | ||||
| # endif | ||||
| #endif | ||||
| 
 | ||||
| #ifndef S_IRGRP | ||||
| # define S_IRGRP (S_IRUSR >> 3) | ||||
| #endif | ||||
| #ifndef S_IWGRP | ||||
| # define S_IWGRP (S_IWUSR >> 3) | ||||
| #endif | ||||
| #ifndef S_IXGRP | ||||
| # define S_IXGRP (S_IXUSR >> 3) | ||||
| #endif | ||||
| #ifndef S_IROTH | ||||
| # define S_IROTH (S_IRUSR >> 6) | ||||
| #endif | ||||
| #ifndef S_IWOTH | ||||
| # define S_IWOTH (S_IWUSR >> 6) | ||||
| #endif | ||||
| #ifndef S_IXOTH | ||||
| # define S_IXOTH (S_IXUSR >> 6) | ||||
| #endif | ||||
| 
 | ||||
| #ifdef STAT_MACROS_BROKEN | ||||
| # undef S_ISBLK | ||||
| # undef S_ISCHR | ||||
| # undef S_ISDIR | ||||
| # undef S_ISFIFO | ||||
| # undef S_ISLNK | ||||
| # undef S_ISMPB | ||||
| # undef S_ISMPC | ||||
| # undef S_ISNWK | ||||
| # undef S_ISREG | ||||
| # undef S_ISSOCK | ||||
| #endif /* STAT_MACROS_BROKEN.  */ | ||||
| 
 | ||||
| #if !defined S_IFBLK && defined _WIN32 | ||||
| # define S_IFBLK 0x3000 | ||||
| #endif | ||||
| #if !defined S_IFIFO && defined _WIN32 | ||||
| # define S_IFIFO 0x1000 | ||||
| #endif | ||||
| 
 | ||||
| #if !defined S_ISBLK && defined S_IFBLK | ||||
| # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||||
| #endif | ||||
| #if !defined S_ISCHR && defined S_IFCHR | ||||
| # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||||
| #endif | ||||
| #if !defined S_ISDIR && defined S_IFDIR | ||||
| # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||||
| #endif | ||||
| #if !defined S_ISREG && defined S_IFREG | ||||
| # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||||
| #endif | ||||
| #if !defined S_ISFIFO && defined S_IFIFO | ||||
| # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||||
| #endif | ||||
| #if !defined HAVE_S_ISLNK | ||||
| # if !defined S_ISLNK && defined S_IFLNK | ||||
| #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | ||||
| # else | ||||
| #  define S_ISLNK(m) ((void)m, 0) | ||||
| # endif | ||||
| #endif | ||||
| #if !defined HAVE_S_ISSOCK | ||||
| # if !defined S_ISSOCK && defined S_IFSOCK | ||||
| #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | ||||
| # else | ||||
| #  define S_ISSOCK(m) ((void)m, 0) | ||||
| # endif | ||||
| #endif | ||||
| #if !defined S_ISMPB && defined S_IFMPB /* V7 */ | ||||
| # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | ||||
| # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | ||||
| #endif | ||||
| #if !defined S_ISNWK && defined S_IFNWK /* HP/UX */ | ||||
| # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | ||||
| #endif | ||||
| #if !defined S_ISDOOR && defined S_IFDOOR /* Solaris 2.5 and up */ | ||||
| # define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR) | ||||
| #endif | ||||
| #if !defined S_ISCTG && defined S_IFCTG /* MassComp */ | ||||
| # define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG) | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __FILEMODE_H__ */ | ||||
							
								
								
									
										249
									
								
								src/libcdio/driver/generic.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								src/libcdio/driver/generic.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,249 @@ | |||
| /*
 | ||||
|   Copyright (C) 2004, 2005, 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /* Internal routines for CD I/O drivers. */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_GENERIC_H__ | ||||
| #define __CDIO_GENERIC_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) | ||||
| # include "config.h" | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/cdtext.h> | ||||
| #include <cdio/iso9660.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*!
 | ||||
|     Things common to private device structures. Even though not all | ||||
|     devices may have some of these fields, by listing common ones | ||||
|     we facilitate writing generic routines and even cut-and-paste | ||||
|     code. | ||||
|    */ | ||||
|   typedef struct { | ||||
|     char *source_name;      /**< Name used in open. */ | ||||
|     bool  init;             /**< True if structure has been initialized */ | ||||
|     bool  toc_init;         /**< True if TOC read in */ | ||||
|     bool  b_cdtext_error;   /**< True if trouble reading CD-Text */ | ||||
|      | ||||
|     int   ioctls_debugged;  /**< for debugging */ | ||||
| 
 | ||||
|     /* Only one of data_source or fd is used; fd  is for CD-ROM
 | ||||
|        devices and the data_source for stream reading (bincue, nrg, toc, | ||||
|        network). | ||||
|      */ | ||||
|     CdioDataSource_t *data_source; | ||||
|     int     fd;             /**< File descriptor of device */ | ||||
|     track_t i_first_track;  /**< The starting track number. */ | ||||
|     track_t i_tracks;       /**< The number of tracks. */ | ||||
| 
 | ||||
|     uint8_t i_joliet_level; /**< 0 = no Joliet extensions.
 | ||||
| 			       1-3: Joliet level. */ | ||||
|     iso9660_pvd_t pvd;       | ||||
|     iso9660_svd_t svd;       | ||||
|     CdIo_t   *cdio;         /**< a way to call general cdio routines. */ | ||||
|     cdtext_t *cdtext;       /**< CD-Text for disc. */ | ||||
|     track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1]; | ||||
| 
 | ||||
|     /* Memorized sense reply of the most recent SCSI command.
 | ||||
|        Recorded by driver implementations of cdio_funcs_t.run_mmc_cmd().  | ||||
|        Read by API function mmc_get_cmd_scsi_sense(). | ||||
|     */ | ||||
|     unsigned char  scsi_mmc_sense[263];   /* See SPC-3 4.5.3 : 252 bytes legal
 | ||||
|                                              but 263 bytes possible */ | ||||
|     int            scsi_mmc_sense_valid;  /* Number of valid sense bytes */ | ||||
| 
 | ||||
|     /* Memorized eventual system specific SCSI address tuple text.
 | ||||
|        Empty text means that there is no such text defined for the drive. | ||||
|        NULL means that the driver does not support "scsi-tuple". | ||||
|        To be read by cdio_get_arg("scsi-tuple"). | ||||
|        System specific suffixes to the key may demand and eventually | ||||
|        guarantee a further specified format. | ||||
|        E.g. "scsi-tuple-linux" guarantees either "Bus,Host,Channel,Target,Lun", | ||||
|                                or empty text, or NULL. No other forms. | ||||
|     */ | ||||
|     char *scsi_tuple; | ||||
|   } generic_img_private_t; | ||||
| 
 | ||||
|   /*!
 | ||||
|     Bogus eject media when there is no ejectable media, e.g. a disk image | ||||
|     We always return 2. Should we also free resources?  | ||||
|   */ | ||||
|   driver_return_code_t cdio_generic_unimplemented_eject_media (void *p_env); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set the blocksize for subsequent reads.  | ||||
|      | ||||
|     @return -2 since it's not implemented. | ||||
|   */ | ||||
|   driver_return_code_t  | ||||
|   cdio_generic_unimplemented_set_blocksize (void *p_user_data,  | ||||
|                                             uint16_t i_blocksize); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set the drive speed. | ||||
|      | ||||
|     @return -2 since it's not implemented. | ||||
|   */ | ||||
|   driver_return_code_t cdio_generic_unimplemented_set_speed (void *p_user_data, | ||||
|                                                              int i_speed); | ||||
|    | ||||
|   /*!
 | ||||
|     Release and free resources associated with cd.  | ||||
|   */ | ||||
|   void cdio_generic_free (void *p_env); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Initialize CD device. | ||||
|   */ | ||||
|   bool cdio_generic_init (void *p_env, int open_mode); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads into buf the next size bytes. | ||||
|     Returns -1 on error.  | ||||
|     Is in fact libc's read(). | ||||
|   */ | ||||
|   off_t cdio_generic_lseek (void *p_env, off_t offset, int whence); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads into buf the next size bytes. | ||||
|     Returns -1 on error.  | ||||
|     Is in fact libc's read(). | ||||
|   */ | ||||
|   ssize_t cdio_generic_read (void *p_env, void *p_buf, size_t size); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads a single form1 sector from cd device into data starting | ||||
|     from lsn. Returns 0 if no error.  | ||||
|   */ | ||||
|   int cdio_generic_read_form1_sector (void * user_data, void *data,  | ||||
|                                       lsn_t lsn); | ||||
|    | ||||
|   /*!
 | ||||
|     Release and free resources associated with stream or disk image. | ||||
|   */ | ||||
|   void cdio_generic_stdio_free (void *env); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     Win32 | ||||
|   */ | ||||
|   bool cdio_is_device_win32(const char *source_name); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     OS/2 | ||||
|   */ | ||||
|   bool cdio_is_device_os2(const char *source_name); | ||||
| 
 | ||||
|    | ||||
|   /*!  
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     most Unix servers with block and character devices. | ||||
|   */ | ||||
|   bool cdio_is_device_generic(const char *source_name); | ||||
| 
 | ||||
|    | ||||
|   /*!  
 | ||||
|     Like above, but don't give a warning device doesn't exist. | ||||
|   */ | ||||
|   bool cdio_is_device_quiet_generic(const char *source_name); | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Get cdtext information for a CdIo object . | ||||
|      | ||||
|     @param obj the CD object that may contain CD-TEXT information. | ||||
|     @return the CD-TEXT object or NULL if obj is NULL | ||||
|     or CD-TEXT information does not exist. | ||||
|   */ | ||||
|   cdtext_t *get_cdtext_generic (void *p_user_data); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the number of of the first track.  | ||||
|     CDIO_INVALID_TRACK is returned on error. | ||||
|   */ | ||||
|   track_t get_first_track_num_generic(void *p_user_data); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the number of tracks in the current medium. | ||||
|   */ | ||||
|   track_t get_num_tracks_generic(void *p_user_data); | ||||
|    | ||||
|   /*! 
 | ||||
|     Get disc type associated with cd object. | ||||
|   */ | ||||
|   discmode_t get_discmode_generic (void *p_user_data ); | ||||
|    | ||||
|   /*! 
 | ||||
|     Same as above but only handles CD cases | ||||
|   */ | ||||
|   discmode_t get_discmode_cd_generic (void *p_user_data ); | ||||
|    | ||||
|   /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|     implemented or -1 for error. | ||||
|     Not meaningful if track is not an audio track. | ||||
|   */ | ||||
|   int  get_track_channels_generic(const void *p_user_data, track_t i_track); | ||||
|    | ||||
|   /*! Return 1 if copy is permitted on the track, 0 if not, or -1 for error.
 | ||||
|     Is this meaningful if not an audio track? | ||||
|   */ | ||||
|   track_flag_t get_track_copy_permit_generic(void *p_user_data,  | ||||
| 					     track_t i_track); | ||||
|    | ||||
|   /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error.
 | ||||
|     Is this meaningful if not an audio track? | ||||
|      | ||||
|     pre-emphasis is a non linear frequency response. | ||||
|   */ | ||||
|   track_flag_t get_track_preemphasis_generic(const void *p_user_data,  | ||||
| 					     track_t i_track); | ||||
|    | ||||
|   /*!
 | ||||
|     Read cdtext information for a CdIo object . | ||||
|    | ||||
|     return true on success, false on error or CD-Text information does | ||||
|     not exist. | ||||
|   */ | ||||
|   uint8_t * read_cdtext_generic (void *p_env); | ||||
|    | ||||
|   void set_track_flags(track_flags_t *p_track_flag, uint8_t flag); | ||||
|    | ||||
|   /*! Read mode 1 or mode2 sectors (using cooked mode).  */ | ||||
|   driver_return_code_t read_data_sectors_generic (void *p_user_data,  | ||||
| 						  void *p_buf, lsn_t i_lsn,  | ||||
| 						  uint16_t i_blocksize,  | ||||
| 						  uint32_t i_blocks); | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_GENERIC_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										147
									
								
								src/libcdio/driver/logging.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								src/libcdio/driver/logging.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,147 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDARG_H | ||||
| #include <stdarg.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/logging.h> | ||||
| #include "cdio_assert.h" | ||||
| #include "portable.h" | ||||
| 
 | ||||
| static const char _rcsid[] = "$Id: logging.c,v 1.2 2008/04/22 15:29:12 karl Exp $"; | ||||
| 
 | ||||
| cdio_log_level_t cdio_loglevel_default = CDIO_LOG_WARN; | ||||
| 
 | ||||
| static void | ||||
| default_cdio_log_handler (cdio_log_level_t level, const char message[]) | ||||
| { | ||||
|   switch (level) | ||||
|     { | ||||
|     case CDIO_LOG_ERROR: | ||||
|       if (level >= cdio_loglevel_default) { | ||||
|         fprintf (stderr, "**ERROR: %s\n", message); | ||||
|         fflush (stderr); | ||||
|       } | ||||
|       exit (EXIT_FAILURE); | ||||
|       break; | ||||
|     case CDIO_LOG_DEBUG: | ||||
|       if (level >= cdio_loglevel_default) { | ||||
|         fprintf (stdout, "--DEBUG: %s\n", message); | ||||
|       } | ||||
|       break; | ||||
|     case CDIO_LOG_WARN: | ||||
|       if (level >= cdio_loglevel_default) { | ||||
|         fprintf (stdout, "++ WARN: %s\n", message); | ||||
|       } | ||||
|       break; | ||||
|     case CDIO_LOG_INFO: | ||||
|       if (level >= cdio_loglevel_default) { | ||||
|         fprintf (stdout, "   INFO: %s\n", message); | ||||
|       } | ||||
|       break; | ||||
|     case CDIO_LOG_ASSERT: | ||||
|       if (level >= cdio_loglevel_default) { | ||||
|         fprintf (stderr, "!ASSERT: %s\n", message); | ||||
|         fflush (stderr); | ||||
|       } | ||||
|       abort (); | ||||
|       break; | ||||
|     default: | ||||
|       cdio_assert_not_reached (); | ||||
|       break; | ||||
|     } | ||||
| 
 | ||||
|   fflush (stdout); | ||||
| } | ||||
| 
 | ||||
| static cdio_log_handler_t _handler = default_cdio_log_handler; | ||||
| 
 | ||||
| cdio_log_handler_t | ||||
| cdio_log_set_handler (cdio_log_handler_t new_handler) | ||||
| { | ||||
|   cdio_log_handler_t old_handler = _handler; | ||||
| 
 | ||||
|   _handler = new_handler; | ||||
| 
 | ||||
|   return old_handler; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| cdio_logv (cdio_log_level_t level, const char format[], va_list args) | ||||
| { | ||||
|   char buf[1024] = { 0, }; | ||||
|   static int in_recursion = 0; | ||||
| 
 | ||||
|   if (in_recursion) | ||||
|     cdio_assert_not_reached (); | ||||
| 
 | ||||
|   in_recursion = 1; | ||||
|    | ||||
|   vsnprintf(buf, sizeof(buf)-1, format, args); | ||||
| 
 | ||||
|   _handler(level, buf); | ||||
| 
 | ||||
|   in_recursion = 0; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| cdio_log (cdio_log_level_t level, const char format[], ...) | ||||
| { | ||||
|   va_list args; | ||||
|   va_start (args, format); | ||||
|   cdio_logv (level, format, args); | ||||
|   va_end (args); | ||||
| } | ||||
| 
 | ||||
| #define CDIO_LOG_TEMPLATE(level, LEVEL) \ | ||||
| void \ | ||||
| cdio_ ## level (const char format[], ...) \ | ||||
| { \ | ||||
|   va_list args; \ | ||||
|   va_start (args, format); \ | ||||
|   cdio_logv (CDIO_LOG_ ## LEVEL, format, args); \ | ||||
|   va_end (args); \ | ||||
| }  | ||||
| 
 | ||||
| CDIO_LOG_TEMPLATE(debug, DEBUG) | ||||
| CDIO_LOG_TEMPLATE(info, INFO) | ||||
| CDIO_LOG_TEMPLATE(warn, WARN) | ||||
| CDIO_LOG_TEMPLATE(error, ERROR) | ||||
| 
 | ||||
| #undef CDIO_LOG_TEMPLATE | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										54
									
								
								src/libcdio/driver/portable.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/libcdio/driver/portable.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| /*
 | ||||
|   Copyright (C) 2006, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /* 
 | ||||
|    This file contains definitions to fill in for differences or | ||||
|    deficiencies to OS or compiler irregularities.  If this file is | ||||
|    included other routines can be more portable. | ||||
| */ | ||||
|  | ||||
| #ifndef __CDIO_PORTABLE_H__ | ||||
| #define __CDIO_PORTABLE_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #if !defined(HAVE_FTRUNCATE) | ||||
| # if defined (_WIN32) | ||||
| #  define ftruncate chsize | ||||
| # endif | ||||
| #endif /*HAVE_FTRUNCATE*/ | ||||
| 
 | ||||
| #if !defined(HAVE_SNPRINTF) | ||||
| # if defined (_MSC_VER) | ||||
| #  define snprintf _snprintf | ||||
| # endif | ||||
| #endif /*HAVE_SNPRINTF*/ | ||||
| 
 | ||||
| #if !defined(HAVE_VSNPRINTF) | ||||
| # if defined (_MSC_VER) | ||||
| #  define vsnprintf _vsnprintf | ||||
| # endif | ||||
| #endif /*HAVE_SNPRINTF*/ | ||||
| 
 | ||||
| #if !defined(HAVE_DRAND48) && defined(HAVE_RAND) | ||||
| # define drand48()   (rand() / (double)RAND_MAX) | ||||
| #endif | ||||
| 
 | ||||
| #endif /* __CDIO_PORTABLE_H__ */ | ||||
							
								
								
									
										328
									
								
								src/libcdio/driver/read.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										328
									
								
								src/libcdio/driver/read.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,328 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /** \file read.h 
 | ||||
|  * | ||||
|  * \brief sector (block, frame)-related libcdio routines. | ||||
|  */ | ||||
|  | ||||
| 
 | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/logging.h> | ||||
| #include "cdio_private.h" | ||||
| #include "cdio_assert.h" | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #define check_read_parms(p_cdio, p_buf, i_lsn)                          \ | ||||
|   if (!p_cdio) return DRIVER_OP_UNINIT;                                 \ | ||||
|   if (!p_buf || CDIO_INVALID_LSN == i_lsn)                              \ | ||||
|     return DRIVER_OP_ERROR;  | ||||
| 
 | ||||
| #define check_lsn(i_lsn)                                                \ | ||||
|   check_read_parms(p_cdio, p_buf, i_lsn);                               \ | ||||
|   {                                                                     \ | ||||
|     lsn_t end_lsn =                                                     \ | ||||
|       cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK);             \ | ||||
|     if ( i_lsn > end_lsn ) {                                            \ | ||||
|       cdio_info("Trying to access past end of disk lsn: %ld, end lsn: %ld", \ | ||||
|                 (long int) i_lsn, (long int) end_lsn);                  \ | ||||
|       return DRIVER_OP_ERROR;                                           \ | ||||
|     }                                                                   \ | ||||
|   } | ||||
| 
 | ||||
| #define check_lsn_blocks(i_lsn, i_blocks)                               \ | ||||
|   check_read_parms(p_cdio, p_buf, i_lsn);                               \ | ||||
|   {                                                                     \ | ||||
|     lsn_t end_lsn =                                                     \ | ||||
|       cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK);             \ | ||||
|     if ( i_lsn > end_lsn ) {                                            \ | ||||
|       cdio_info("Trying to access past end of disk lsn: %ld, end lsn: %ld", \ | ||||
|                 (long int) i_lsn, (long int) end_lsn);                   \ | ||||
|       return DRIVER_OP_ERROR;                                            \ | ||||
|     }                                                                    \ | ||||
|     /* Care is used in the expression below to be correct with */        \ | ||||
|     /* respect to unsigned integers.                           */        \ | ||||
|     if ( i_lsn + i_blocks > end_lsn + 1 ) {                              \ | ||||
|       cdio_info("Request truncated to end disk; lsn: %ld, end lsn: %ld", \ | ||||
|                 (long int) i_lsn, (long int) end_lsn);                   \ | ||||
|       i_blocks = end_lsn - i_lsn + 1;                                    \ | ||||
|     }                                                                    \ | ||||
|   } | ||||
| 
 | ||||
| /*!
 | ||||
|   lseek - reposition read/write file offset | ||||
|   Returns (off_t) -1 on error.  | ||||
|   Similar to (if not the same as) libc's lseek() | ||||
| */ | ||||
| off_t | ||||
| cdio_lseek (const CdIo_t *p_cdio, off_t offset, int whence) | ||||
| { | ||||
|   if (!p_cdio) return DRIVER_OP_UNINIT; | ||||
|    | ||||
|   if (p_cdio->op.lseek) | ||||
|     return (p_cdio->op.lseek) (p_cdio->env, offset, whence); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!  Reads into buf the next size bytes.  Similar to (if not the
 | ||||
|   same as) libc's read(). This is a "cooked" read, or one handled by | ||||
|   the OS. It probably won't work on audio data. For that use | ||||
|   cdio_read_audio_sector(s). | ||||
| 
 | ||||
|   @param p_cdio object to read from | ||||
|   @param p_buf place to read data into. The caller should make sure | ||||
|                this location can store at least i_size bytes. | ||||
|   @param i_size number of bytes to read | ||||
| 
 | ||||
|   @return (ssize_t) -1 on error.  | ||||
| */ | ||||
| ssize_t | ||||
| cdio_read (const CdIo_t *p_cdio, void *p_buf, size_t i_size) | ||||
| { | ||||
|   if (!p_cdio) return DRIVER_OP_UNINIT; | ||||
|    | ||||
|   if (p_cdio->op.read) | ||||
|     return (p_cdio->op.read) (p_cdio->env, p_buf, i_size); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads an audio sector from cd device into data starting | ||||
|   from lsn. Returns DRIVER_OP_SUCCESS if no error.  | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_audio_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn)  | ||||
| { | ||||
|   check_lsn(i_lsn); | ||||
|   if  (p_cdio->op.read_audio_sectors) | ||||
|     return p_cdio->op.read_audio_sectors (p_cdio->env, p_buf, i_lsn, 1); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads audio sectors from cd device into data starting | ||||
|   from lsn. Returns DRIVER_OP_SUCCESS if no error.  | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_audio_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn, | ||||
|                          uint32_t i_blocks)  | ||||
| { | ||||
|   check_lsn_blocks(i_lsn, i_blocks); | ||||
| 
 | ||||
|   if (0 == i_blocks) return DRIVER_OP_SUCCESS; | ||||
| 
 | ||||
|   if (p_cdio->op.read_audio_sectors) | ||||
|     return (p_cdio->op.read_audio_sectors) (p_cdio->env, p_buf, i_lsn,  | ||||
|                                             i_blocks); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads an audio sector from cd device into data starting | ||||
|   from lsn. Returns DRIVER_OP_SUCCESS if no error.  | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_data_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn, | ||||
|                         uint16_t i_blocksize, uint32_t i_blocks)  | ||||
| { | ||||
|   check_lsn(i_lsn); | ||||
| 
 | ||||
|   if (0 == i_blocks) return DRIVER_OP_SUCCESS; | ||||
| 
 | ||||
|   if  (p_cdio->op.read_data_sectors) | ||||
|     return p_cdio->op.read_data_sectors (p_cdio->env, p_buf, i_lsn,  | ||||
|                                          i_blocksize, i_blocks); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| #ifndef SEEK_SET | ||||
| #define SEEK_SET 0 | ||||
| #endif  | ||||
| 
 | ||||
| /*!
 | ||||
|    Reads a single mode1 form1 or form2  sector from cd device  | ||||
|    into data starting from lsn. Returns DRIVER_OP_SUCCESS if no error.  | ||||
|  */ | ||||
| driver_return_code_t | ||||
| cdio_read_mode1_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                         bool b_form2) | ||||
| { | ||||
|   uint32_t size = b_form2 ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE ; | ||||
| 
 | ||||
|   check_lsn(i_lsn); | ||||
|   if (p_cdio->op.read_mode1_sector) { | ||||
|     return p_cdio->op.read_mode1_sector(p_cdio->env, p_buf, i_lsn, b_form2); | ||||
|   } else if (p_cdio->op.lseek && p_cdio->op.read) { | ||||
|     char buf[M2RAW_SECTOR_SIZE] = { 0, }; | ||||
|     if (0 > cdio_lseek(p_cdio, CDIO_CD_FRAMESIZE*i_lsn, SEEK_SET)) | ||||
|       return -1; | ||||
|     if (0 > cdio_read(p_cdio, buf, CDIO_CD_FRAMESIZE)) | ||||
|       return -1; | ||||
|     memcpy (p_buf, buf, size); | ||||
|     return DRIVER_OP_SUCCESS; | ||||
|   }  | ||||
| 
 | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads mode 1 sectors | ||||
|    | ||||
|   @param p_cdio object to read from | ||||
|   @param buf place to read data into | ||||
|   @param lsn sector to read | ||||
|   @param b_form2 true for reading mode 1 form 2 sectors or false for  | ||||
|   mode 1 form 1 sectors. | ||||
|   @param i_blocks number of sectors to read | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_mode1_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                          bool b_form2,  uint32_t i_blocks) | ||||
| { | ||||
|   check_lsn_blocks(i_lsn, i_blocks); | ||||
| 
 | ||||
|   if (0 == i_blocks) return DRIVER_OP_SUCCESS; | ||||
| 
 | ||||
|   if (p_cdio->op.read_mode1_sectors) | ||||
|     return (p_cdio->op.read_mode1_sectors) (p_cdio->env, p_buf, i_lsn, b_form2, | ||||
|                                             i_blocks); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads a mode 2 sector | ||||
|    | ||||
|   @param p_cdio object to read from | ||||
|   @param buf place to read data into | ||||
|   @param lsn sector to read | ||||
|   @param b_form2 true for reading mode 2 form 2 sectors or false for  | ||||
|   mode 2 form 1 sectors. | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_mode2_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                         bool b_form2) | ||||
| { | ||||
|   check_lsn(i_lsn); | ||||
|   if (p_cdio->op.read_mode2_sector) | ||||
|     return p_cdio->op.read_mode2_sector (p_cdio->env, p_buf, i_lsn, b_form2); | ||||
| 
 | ||||
|   /* fallback */ | ||||
|   if (p_cdio->op.read_mode2_sectors != NULL) | ||||
|     return cdio_read_mode2_sectors (p_cdio, p_buf, i_lsn, b_form2, 1); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads mode 2 sectors | ||||
|    | ||||
|   @param p_cdio object to read from | ||||
|   @param buf place to read data into | ||||
|   @param lsn sector to read | ||||
|   @param b_form2 true for reading mode2 form 2 sectors or false for  | ||||
|   mode 2  form 1 sectors. | ||||
|   @param i_blocks number of sectors to read | ||||
| */ | ||||
| driver_return_code_t | ||||
| cdio_read_mode2_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                          bool b_form2, uint32_t i_blocks) | ||||
| { | ||||
|   check_lsn_blocks(i_lsn, i_blocks); | ||||
| 
 | ||||
|   if (0 == i_blocks) return DRIVER_OP_SUCCESS; | ||||
| 
 | ||||
|   if (p_cdio->op.read_mode2_sectors)  | ||||
|     return (p_cdio->op.read_mode2_sectors) (p_cdio->env, p_buf, i_lsn, | ||||
|                                             b_form2, i_blocks); | ||||
|   return DRIVER_OP_UNSUPPORTED; | ||||
|    | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** The special case of reading a single block is a common one so we
 | ||||
|     provide a routine for that as a convenience. | ||||
| */ | ||||
| driver_return_code_t  | ||||
| cdio_read_sector(const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                  cdio_read_mode_t read_mode) | ||||
| { | ||||
|   return cdio_read_sectors(p_cdio, p_buf, i_lsn, read_mode, 1); | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Reads a number of sectors (AKA blocks). | ||||
|    | ||||
|   @param p_buf place to read data into. The caller should make sure | ||||
|   this location is large enough. See below for size information. | ||||
|   @param read_mode the kind of "mode" to use in reading. | ||||
|   @param i_lsn sector to read | ||||
|   @param i_blocks number of sectors to read | ||||
|   @return DRIVER_OP_SUCCESS (0) if no error, other (negative) enumerations | ||||
|   are returned on error. | ||||
|    | ||||
|   If read_mode is CDIO_MODE_AUDIO, | ||||
|     *p_buf should hold at least CDIO_FRAMESIZE_RAW * i_blocks bytes. | ||||
| 
 | ||||
|   If read_mode is CDIO_MODE_DATA, | ||||
|     *p_buf should hold at least i_blocks times either ISO_BLOCKSIZE,  | ||||
|     M1RAW_SECTOR_SIZE or M2F2_SECTOR_SIZE depending on the kind of  | ||||
|     sector getting read. If you don't know whether you have a Mode 1/2,  | ||||
|     Form 1/ Form 2/Formless sector best to reserve space for the maximum | ||||
|     which is M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|   If read_mode is CDIO_MODE_M2F1, | ||||
|     *p_buf should hold at least M2RAW_SECTOR_SIZE * i_blocks bytes. | ||||
| 
 | ||||
|   If read_mode is CDIO_MODE_M2F2, | ||||
|     *p_buf should hold at least CDIO_CD_FRAMESIZE * i_blocks bytes. | ||||
| 
 | ||||
| 
 | ||||
| */ | ||||
| driver_return_code_t  | ||||
| cdio_read_sectors(const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,  | ||||
|                   cdio_read_mode_t read_mode, uint32_t i_blocks) | ||||
| { | ||||
|   switch(read_mode) { | ||||
|   case CDIO_READ_MODE_AUDIO: | ||||
|     return cdio_read_audio_sectors (p_cdio, p_buf, i_lsn, i_blocks); | ||||
|   case CDIO_READ_MODE_M1F1: | ||||
|     return cdio_read_mode1_sectors (p_cdio, p_buf, i_lsn, false, i_blocks); | ||||
|   case CDIO_READ_MODE_M1F2: | ||||
|     return cdio_read_mode1_sectors (p_cdio, p_buf, i_lsn, true,  i_blocks); | ||||
|   case CDIO_READ_MODE_M2F1: | ||||
|     return cdio_read_mode2_sectors (p_cdio, p_buf, i_lsn, false, i_blocks); | ||||
|   case CDIO_READ_MODE_M2F2: | ||||
|     return cdio_read_mode2_sectors (p_cdio, p_buf, i_lsn, true,  i_blocks); | ||||
|   } | ||||
|   /* Can't happen. Just to shut up gcc. */ | ||||
|   return DRIVER_OP_ERROR;  | ||||
| } | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										270
									
								
								src/libcdio/driver/sector.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										270
									
								
								src/libcdio/driver/sector.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,270 @@ | |||
| /*
 | ||||
|     Copyright (C) 2004, 2005, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|     This program is free software; you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation; either version 2 of the License, or | ||||
|     (at your option) any later version. | ||||
| 
 | ||||
|     This program is distributed in the hope that it will be useful, | ||||
|     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|     GNU General Public License for more details. | ||||
| 
 | ||||
|     You should have received a copy of the GNU General Public License | ||||
|     along with this program; if not, write to the Free Software | ||||
|     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/sector.h> | ||||
| #include <cdio/util.h> | ||||
| #include <cdio/logging.h> | ||||
| #include "cdio_assert.h" | ||||
| #include "portable.h" | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <ctype.h> | ||||
| 
 | ||||
| static const char _rcsid[] = "$Id: sector.c,v 1.5 2005/02/06 04:20:25 rocky Exp $"; | ||||
| 
 | ||||
| /*! String of bytes used to identify the beginning of a Mode 1 or
 | ||||
|   Mode 2 sector. */ | ||||
| const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE] =  | ||||
|   {0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}; | ||||
| 
 | ||||
| /* Variables to hold debugger-helping enumerations */ | ||||
| enum cdio_cd_enums; | ||||
| enum m2_sector_enums; | ||||
|        | ||||
| lba_t | ||||
| cdio_lba_to_lsn (lba_t lba) | ||||
| { | ||||
|   if (CDIO_INVALID_LBA     == lba) return CDIO_INVALID_LSN; | ||||
|   return lba - CDIO_PREGAP_SECTORS;  | ||||
| } | ||||
| 
 | ||||
| /* 
 | ||||
|    The below is adapted from cdparanoia code which claims it is | ||||
|    straight from the MMC3 spec. | ||||
| */ | ||||
| 
 | ||||
| void | ||||
| cdio_lsn_to_msf (lsn_t lsn, msf_t *msf) | ||||
| { | ||||
|   int m, s, f; | ||||
|    | ||||
|   cdio_assert (msf != 0); | ||||
| 
 | ||||
|   if ( lsn >= -CDIO_PREGAP_SECTORS ){ | ||||
|     m    = (lsn + CDIO_PREGAP_SECTORS) / CDIO_CD_FRAMES_PER_MIN; | ||||
|     lsn -= m * CDIO_CD_FRAMES_PER_MIN; | ||||
|     s    = (lsn + CDIO_PREGAP_SECTORS) / CDIO_CD_FRAMES_PER_SEC; | ||||
|     lsn -= s * CDIO_CD_FRAMES_PER_SEC; | ||||
|     f    = lsn + CDIO_PREGAP_SECTORS; | ||||
|   } else { | ||||
|     m    = (lsn + CDIO_CD_MAX_LSN)     / CDIO_CD_FRAMES_PER_MIN; | ||||
|     lsn -= m * (CDIO_CD_FRAMES_PER_MIN); | ||||
|     s    = (lsn+CDIO_CD_MAX_LSN)       / CDIO_CD_FRAMES_PER_SEC; | ||||
|     lsn -= s * CDIO_CD_FRAMES_PER_SEC; | ||||
|     f    = lsn + CDIO_CD_MAX_LSN; | ||||
|   } | ||||
| 
 | ||||
|   if (m > 99) { | ||||
|     cdio_warn ("number of minutes (%d) truncated to 99.", m); | ||||
|     m = 99; | ||||
|   } | ||||
|    | ||||
|   msf->m = cdio_to_bcd8 (m); | ||||
|   msf->s = cdio_to_bcd8 (s); | ||||
|   msf->f = cdio_to_bcd8 (f); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert an LBA into a string representation of the MSF. | ||||
|   \warning cdio_lba_to_msf_str returns new allocated string */ | ||||
| char * | ||||
| cdio_lba_to_msf_str (lba_t lba) | ||||
| { | ||||
| 
 | ||||
|   if (CDIO_INVALID_LBA == lba) { | ||||
|     return strdup("*INVALID"); | ||||
|   } else { | ||||
|     msf_t msf; | ||||
|     msf.m = msf.s = msf.f = 0; | ||||
|     cdio_lba_to_msf (lba, &msf); | ||||
|     return cdio_msf_to_str(&msf); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert an LSN into the corresponding LBA. | ||||
|   CDIO_INVALID_LBA is returned if there is an error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_lsn_to_lba (lsn_t lsn) | ||||
| { | ||||
|   if (CDIO_INVALID_LSN  == lsn) return CDIO_INVALID_LBA; | ||||
|   return lsn + CDIO_PREGAP_SECTORS;  | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert an LBA into the corresponding MSF. | ||||
| */ | ||||
| void | ||||
| cdio_lba_to_msf (lba_t lba, msf_t *msf) | ||||
| { | ||||
|   cdio_assert (msf != 0); | ||||
|   cdio_lsn_to_msf(cdio_lba_to_lsn(lba), msf); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert a MSF into the corresponding LBA. | ||||
|   CDIO_INVALID_LBA is returned if there is an error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_msf_to_lba (const msf_t *msf) | ||||
| { | ||||
|   uint32_t lba = 0; | ||||
| 
 | ||||
|   cdio_assert (msf != 0); | ||||
| 
 | ||||
|   lba = cdio_from_bcd8 (msf->m); | ||||
|   lba *= CDIO_CD_SECS_PER_MIN; | ||||
| 
 | ||||
|   lba += cdio_from_bcd8 (msf->s); | ||||
|   lba *= CDIO_CD_FRAMES_PER_SEC; | ||||
|    | ||||
|   lba += cdio_from_bcd8 (msf->f); | ||||
| 
 | ||||
|   return lba; | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert a MSF into the corresponding LSN. | ||||
|   CDIO_INVALID_LSN is returned if there is an error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_msf_to_lsn (const msf_t *msf) | ||||
| { | ||||
|   return cdio_lba_to_lsn(cdio_msf_to_lba (msf)); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert an LBA into a string representation of the MSF. | ||||
|   \warning cdio_lba_to_msf_str returns new allocated string */ | ||||
| char * | ||||
| cdio_msf_to_str (const msf_t *msf) | ||||
| { | ||||
|   char buf[16]; | ||||
|    | ||||
|   snprintf (buf, sizeof (buf), "%2.2x:%2.2x:%2.2x", msf->m, msf->s, msf->f); | ||||
|   return strdup (buf); | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Convert a MSF - broken out as 3 integer components into the | ||||
|   corresponding LBA.   | ||||
|   CDIO_INVALID_LBA is returned if there is an error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds,  | ||||
|                   unsigned int frames) | ||||
| { | ||||
|   return ((minutes * CDIO_CD_SECS_PER_MIN + seconds) * CDIO_CD_FRAMES_PER_SEC  | ||||
| 	  + frames); | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Convert a string of the form MM:SS:FF into the corresponding LBA. | ||||
|   CDIO_INVALID_LBA is returned if there is an error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_mmssff_to_lba (const char *psz_mmssff) | ||||
| { | ||||
|   int psz_field; | ||||
|   lba_t ret; | ||||
|   char c; | ||||
|    | ||||
|   if (0 == strcmp (psz_mmssff, "0")) | ||||
|     return 0; | ||||
|    | ||||
|   c = *psz_mmssff++; | ||||
|   if(c >= '0' && c <= '9') | ||||
|     psz_field = (c - '0'); | ||||
|   else | ||||
|     return CDIO_INVALID_LBA; | ||||
|   while(':' != (c = *psz_mmssff++)) { | ||||
|     if(c >= '0' && c <= '9') | ||||
|       psz_field = psz_field * 10 + (c - '0'); | ||||
|     else | ||||
|       return CDIO_INVALID_LBA; | ||||
|   } | ||||
|    | ||||
|   ret = cdio_msf3_to_lba (psz_field, 0, 0); | ||||
|    | ||||
|   c = *psz_mmssff++; | ||||
|   if(c >= '0' && c <= '9') | ||||
|     psz_field = (c - '0'); | ||||
|   else | ||||
|     return CDIO_INVALID_LBA; | ||||
|   if(':' != (c = *psz_mmssff++)) { | ||||
|     if(c >= '0' && c <= '9') { | ||||
|       psz_field = psz_field * 10 + (c - '0'); | ||||
|       c = *psz_mmssff++; | ||||
|       if(c != ':') | ||||
| 	return CDIO_INVALID_LBA; | ||||
|     } | ||||
|     else | ||||
|       return CDIO_INVALID_LBA; | ||||
|   } | ||||
|    | ||||
|   if(psz_field >= CDIO_CD_SECS_PER_MIN) | ||||
|     return CDIO_INVALID_LBA; | ||||
|    | ||||
|   ret += cdio_msf3_to_lba (0, psz_field, 0); | ||||
|    | ||||
|   c = *psz_mmssff++; | ||||
|   if (isdigit(c)) | ||||
|     psz_field = (c - '0'); | ||||
|   else | ||||
|     return -1; | ||||
|   if('\0' != (c = *psz_mmssff++)) { | ||||
|     if (isdigit(c)) { | ||||
|       psz_field = psz_field * 10 + (c - '0'); | ||||
|       c = *psz_mmssff++; | ||||
|     } | ||||
|     else | ||||
|       return CDIO_INVALID_LBA; | ||||
|   } | ||||
|    | ||||
|   if('\0' != c) | ||||
|     return CDIO_INVALID_LBA; | ||||
|    | ||||
|   if(psz_field >= CDIO_CD_FRAMES_PER_SEC) | ||||
|     return CDIO_INVALID_LBA; | ||||
|    | ||||
|   ret += psz_field; | ||||
|    | ||||
|   return ret; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										360
									
								
								src/libcdio/driver/track.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										360
									
								
								src/libcdio/driver/track.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,360 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*! Track-related routines. */ | ||||
|  | ||||
| 
 | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include "cdio_private.h" | ||||
| 
 | ||||
| const char *track_format2str[6] =  | ||||
|   { | ||||
|     "audio", "CD-i", "XA", "data", "PSX", "error" | ||||
|   }; | ||||
| 
 | ||||
| /* Variables to hold debugger-helping enumerations */ | ||||
| enum cdio_track_enums; | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the number of the first track.  | ||||
|   CDIO_INVALID_TRACK is returned on error. | ||||
| */ | ||||
| track_t | ||||
| cdio_get_first_track_num (const CdIo_t *p_cdio) | ||||
| { | ||||
|   if (NULL == p_cdio) return CDIO_INVALID_TRACK; | ||||
| 
 | ||||
|   if (p_cdio->op.get_first_track_num) { | ||||
|     return p_cdio->op.get_first_track_num (p_cdio->env); | ||||
|   } else { | ||||
|     return CDIO_INVALID_TRACK; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the last track number. | ||||
|   CDIO_INVALID_TRACK is returned on error. | ||||
| */ | ||||
| track_t | ||||
| cdio_get_last_track_num (const CdIo_t *p_cdio) | ||||
| { | ||||
|   if (NULL == p_cdio) return CDIO_INVALID_TRACK; | ||||
|   { | ||||
|     const track_t i_first_track = cdio_get_first_track_num(p_cdio); | ||||
|     if ( CDIO_INVALID_TRACK != i_first_track ) { | ||||
|       const track_t i_tracks = cdio_get_num_tracks(p_cdio); | ||||
|       if ( CDIO_INVALID_TRACK != i_tracks )  | ||||
| 	return i_first_track + i_tracks - 1; | ||||
|     } | ||||
|     return CDIO_INVALID_TRACK; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|   implemented or -1 for error. | ||||
|   Not meaningful if track is not an audio track. | ||||
| */ | ||||
| int | ||||
| cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio->op.get_track_channels) { | ||||
|     return p_cdio->op.get_track_channels (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return -2; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! Return copy protection status on a track. Is this meaningful
 | ||||
|   if not an audio track? | ||||
| */ | ||||
| track_flag_t | ||||
| cdio_get_track_copy_permit(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio->op.get_track_copy_permit) { | ||||
|     return p_cdio->op.get_track_copy_permit (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return CDIO_TRACK_FLAG_UNKNOWN; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Get format of track.  | ||||
| */ | ||||
| track_format_t | ||||
| cdio_get_track_format(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (!p_cdio) return TRACK_FORMAT_ERROR; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_format) { | ||||
|     return p_cdio->op.get_track_format (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return TRACK_FORMAT_ERROR; | ||||
|   } | ||||
| } | ||||
| /*!  
 | ||||
|   Return the Joliet level recognized for p_cdio. | ||||
| */ | ||||
| uint8_t  | ||||
| cdio_get_joliet_level(const CdIo_t *p_cdio) | ||||
| { | ||||
|   if (!p_cdio) return 0; | ||||
|   { | ||||
|     const generic_img_private_t *p_env  | ||||
|       = (generic_img_private_t *) (p_cdio->env); | ||||
|     return p_env->i_joliet_level; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! 
 | ||||
|   Return the number of tracks in the current medium. | ||||
|   CDIO_INVALID_TRACK is returned on error. | ||||
| */ | ||||
| track_t | ||||
| cdio_get_num_tracks (const CdIo_t *p_cdio) | ||||
| { | ||||
|   if (p_cdio == NULL) return CDIO_INVALID_TRACK; | ||||
| 
 | ||||
|   if (p_cdio->op.get_num_tracks) { | ||||
|     return p_cdio->op.get_num_tracks (p_cdio->env); | ||||
|   } else { | ||||
|     return CDIO_INVALID_TRACK; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! Find the track which contans lsn.
 | ||||
|     CDIO_INVALID_TRACK is returned if the lsn outside of the CD or | ||||
|     if there was some error.  | ||||
|      | ||||
|     If the lsn is before the pregap of the first track 0 is returned. | ||||
|     Otherwise we return the track that spans the lsn. | ||||
| */ | ||||
| track_t | ||||
| cdio_get_track(const CdIo_t *p_cdio, lsn_t lsn) | ||||
| { | ||||
|   if (!p_cdio) return CDIO_INVALID_TRACK; | ||||
|    | ||||
|   { | ||||
|     track_t i_low_track   = cdio_get_first_track_num(p_cdio); | ||||
|     track_t i_high_track  = cdio_get_last_track_num(p_cdio)+1; /* LEADOUT */ | ||||
| 
 | ||||
|     if (CDIO_INVALID_TRACK == i_low_track  | ||||
| 	|| CDIO_INVALID_TRACK == i_high_track ) return CDIO_INVALID_TRACK; | ||||
|      | ||||
|     if (lsn < cdio_get_track_lsn(p_cdio, i_low_track)) | ||||
|       return 0; /* We're in the pre-gap of first track */ | ||||
| 
 | ||||
|     if (lsn > cdio_get_track_lsn(p_cdio, i_high_track)) | ||||
|       return CDIO_INVALID_TRACK; /* We're beyond the end. */ | ||||
| 
 | ||||
|     do { | ||||
|       const track_t i_mid = (i_low_track + i_high_track) / 2; | ||||
|       const lsn_t i_mid_lsn = cdio_get_track_lsn(p_cdio, i_mid); | ||||
|       if (lsn <= i_mid_lsn) i_high_track = i_mid - 1; | ||||
|       if (lsn >= i_mid_lsn) i_low_track  = i_mid + 1; | ||||
|     } while ( i_low_track <= i_high_track ); | ||||
| 
 | ||||
|     return (i_low_track > i_high_track + 1)  | ||||
|       ? i_high_track + 1 : i_high_track; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return true if we have XA data (green, mode2 form1) or | ||||
|   XA data (green, mode2 form2). That is track begins: | ||||
|   sync - header - subheader | ||||
|   12     4      -  8 | ||||
|    | ||||
|   FIXME: there's gotta be a better design for this and get_track_format? | ||||
| */ | ||||
| bool | ||||
| cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio == NULL) { | ||||
|     return false; | ||||
|   } | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_green) { | ||||
|     return p_cdio->op.get_track_green (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the starting LBA for track number | ||||
|   track_num in cdio.  Tracks numbers start at 1. | ||||
|   The "leadout" track is specified either by | ||||
|   using track_num LEADOUT_TRACK or the total tracks+1. | ||||
|   CDIO_INVALID_LBA is returned on error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (!p_cdio) return CDIO_INVALID_LBA; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_lba) { | ||||
|     return p_cdio->op.get_track_lba (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     msf_t msf; | ||||
|     if (p_cdio->op.get_track_msf)  | ||||
|       if (cdio_get_track_msf(p_cdio, i_track, &msf)) | ||||
|         return cdio_msf_to_lba(&msf); | ||||
|     return CDIO_INVALID_LBA; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the starting LSN for track number | ||||
|   i_track in cdio.  Tracks numbers start at 1. | ||||
|   The "leadout" track is specified either by | ||||
|   using i_track LEADOUT_TRACK or the total tracks+1. | ||||
|   CDIO_INVALID_LSN is returned on error. | ||||
| */ | ||||
| lsn_t | ||||
| cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio == NULL) return CDIO_INVALID_LSN; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_lba) { | ||||
|     return cdio_lba_to_lsn(p_cdio->op.get_track_lba (p_cdio->env, i_track)); | ||||
|   } else { | ||||
|     msf_t msf; | ||||
|     if (cdio_get_track_msf(p_cdio, i_track, &msf)) | ||||
|       return cdio_msf_to_lsn(&msf); | ||||
|     return CDIO_INVALID_LSN; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the International Standard Recording Code (ISRC) for track number | ||||
|   i_track in p_cdio.  Track numbers start at 1. | ||||
| 
 | ||||
|   Note: string is malloc'd so caller has to free() the returned | ||||
|   string when done with it. | ||||
| */ | ||||
| char * | ||||
| cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio == NULL) return NULL; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_isrc) { | ||||
|     return p_cdio->op.get_track_isrc (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return NULL; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the starting LBA for the pregap for track number | ||||
|   i_track in cdio.  Track numbers start at 1. | ||||
|   CDIO_INVALID_LBA is returned on error. | ||||
| */ | ||||
| lba_t | ||||
| cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio == NULL) return CDIO_INVALID_LBA; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_pregap_lba) { | ||||
|     return p_cdio->op.get_track_pregap_lba (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return CDIO_INVALID_LBA; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the starting LSN for the pregap for track number | ||||
|   i_track in cdio.  Track numbers start at 1. | ||||
|   CDIO_INVALID_LSN is returned on error. | ||||
| */ | ||||
| lsn_t | ||||
| cdio_get_track_pregap_lsn(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   return cdio_lba_to_lsn(cdio_get_track_pregap_lba(p_cdio, i_track)); | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the ending LSN for track number | ||||
|   i_track in cdio.  CDIO_INVALID_LSN is returned on error. | ||||
| */ | ||||
| lsn_t | ||||
| cdio_get_track_last_lsn(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   lsn_t lsn = cdio_get_track_lsn(p_cdio, i_track+1); | ||||
| 
 | ||||
|   if (CDIO_INVALID_LSN == lsn) return CDIO_INVALID_LSN; | ||||
|   /* Safe, we've always the leadout. */ | ||||
|   return lsn - 1; | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the starting MSF (minutes/secs/frames) for track number | ||||
|   i_track in cdio.  Track numbers start at 1. | ||||
|   The "leadout" track is specified either by | ||||
|   using i_track LEADOUT_TRACK or the total tracks+1. | ||||
|   False is returned if there is no track entry. | ||||
| */ | ||||
| bool | ||||
| cdio_get_track_msf(const CdIo_t *p_cdio, track_t i_track, /*out*/ msf_t *msf) | ||||
| { | ||||
|   if (!p_cdio) return false; | ||||
| 
 | ||||
|   if (p_cdio->op.get_track_msf) { | ||||
|     return p_cdio->op.get_track_msf (p_cdio->env, i_track, msf); | ||||
|   } else if (p_cdio->op.get_track_lba) { | ||||
|     lba_t lba = p_cdio->op.get_track_lba (p_cdio->env, i_track); | ||||
|     if (lba  == CDIO_INVALID_LBA) return false; | ||||
|     cdio_lba_to_msf(lba, msf); | ||||
|     return true; | ||||
|   } else { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*! Return copy protection status on a track. Is this meaningful
 | ||||
|   if not an audio track? | ||||
| */ | ||||
| track_flag_t | ||||
| cdio_get_track_preemphasis(const CdIo *p_cdio, track_t i_track) | ||||
| { | ||||
|   if (p_cdio->op.get_track_preemphasis) { | ||||
|     return p_cdio->op.get_track_preemphasis (p_cdio->env, i_track); | ||||
|   } else { | ||||
|     return CDIO_TRACK_FLAG_UNKNOWN; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!  
 | ||||
|   Return the number of sectors between this track an the next.  This | ||||
|   includes any pregap sectors before the start of the next track. | ||||
|   Tracks start at 1. | ||||
|   0 is returned if there is an error. | ||||
| */ | ||||
| unsigned int | ||||
| cdio_get_track_sec_count(const CdIo_t *p_cdio, track_t i_track) | ||||
| { | ||||
|   const track_t i_tracks = cdio_get_num_tracks(p_cdio); | ||||
| 
 | ||||
|   if (i_track >=1 && i_track <= i_tracks)  | ||||
|     return ( cdio_get_track_lba(p_cdio, i_track+1)  | ||||
|              - cdio_get_track_lba(p_cdio, i_track) ); | ||||
|   return 0; | ||||
| } | ||||
							
								
								
									
										301
									
								
								src/libcdio/driver/utf8.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								src/libcdio/driver/utf8.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,301 @@ | |||
| /*
 | ||||
|   Copyright (C) 2006, 2008 Burkhard Plaum <plaum@ipf.uni-stuttgart.de> | ||||
|   Copyright (C) 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2012 Pete Batard <pete@akeo.ie> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /* UTF-8 support */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| # include "config.h" | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_JOLIET | ||||
| #ifdef HAVE_STRING_H | ||||
| # include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_ERRNO_H | ||||
| #include <errno.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/utf8.h> | ||||
| #include <cdio/logging.h> | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| 
 | ||||
| // TODO: also remove the need for iconv on MinGW
 | ||||
| #ifdef HAVE_ICONV | ||||
| #include <iconv.h> | ||||
| struct cdio_charset_coverter_s | ||||
|   { | ||||
|   iconv_t ic; | ||||
|   }; | ||||
| 
 | ||||
| cdio_charset_coverter_t * | ||||
| cdio_charset_converter_create(const char * src_charset, | ||||
|                               const char * dst_charset) | ||||
|   { | ||||
|   cdio_charset_coverter_t * ret; | ||||
|   ret = calloc(1, sizeof(*ret)); | ||||
|   ret->ic = iconv_open(dst_charset, src_charset); | ||||
|   return ret; | ||||
|   } | ||||
| 
 | ||||
| #if 0 | ||||
| static void bgav_hexdump(uint8_t * data, int len, int linebreak) | ||||
|   { | ||||
|   int i; | ||||
|   int bytes_written = 0; | ||||
|   int imax; | ||||
|    | ||||
|   while(bytes_written < len) | ||||
|     { | ||||
|     imax = (bytes_written + linebreak > len) ? len - bytes_written : linebreak; | ||||
|     for(i = 0; i < imax; i++) | ||||
|       fprintf(stderr, "%02x ", data[bytes_written + i]); | ||||
|     for(i = imax; i < linebreak; i++) | ||||
|       fprintf(stderr, "   "); | ||||
|     for(i = 0; i < imax; i++) | ||||
|       { | ||||
|       if(!(data[bytes_written + i] & 0x80) && (data[bytes_written + i] >= 32)) | ||||
|         fprintf(stderr, "%c", data[bytes_written + i]); | ||||
|       else | ||||
|         fprintf(stderr, "."); | ||||
|       } | ||||
|     bytes_written += imax; | ||||
|     fprintf(stderr, "\n"); | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
| 
 | ||||
| void cdio_charset_converter_destroy(cdio_charset_coverter_t*cnv) | ||||
|   { | ||||
|   iconv_close(cnv->ic); | ||||
|   free(cnv); | ||||
|   } | ||||
| 
 | ||||
| #define BYTES_INCREMENT 16 | ||||
| 
 | ||||
| static bool | ||||
| do_convert(iconv_t cd, char * src, int src_len, | ||||
|            char ** dst, int *dst_len) | ||||
|   { | ||||
|   char * ret; | ||||
| 
 | ||||
|   char *inbuf; | ||||
|   char *outbuf; | ||||
|   int alloc_size; | ||||
|   int output_pos; | ||||
|   size_t inbytesleft; | ||||
|   size_t outbytesleft; | ||||
| 
 | ||||
|   if(src_len < 0) | ||||
|     src_len = strlen(src); | ||||
| #if 0 | ||||
|   fprintf(stderr, "Converting:\n"); | ||||
|   bgav_hexdump(src, src_len, 16); | ||||
| #endif     | ||||
|   alloc_size = src_len + BYTES_INCREMENT; | ||||
| 
 | ||||
|   inbytesleft  = src_len; | ||||
|    | ||||
|   /* We reserve space here to add a final '\0' */ | ||||
|   outbytesleft = alloc_size-1; | ||||
| 
 | ||||
|   ret    = malloc(alloc_size); | ||||
| 
 | ||||
|   inbuf  = src; | ||||
|   outbuf = ret; | ||||
|    | ||||
|   while(1) | ||||
|     { | ||||
|      | ||||
|     if(iconv(cd, (ICONV_CONST char **)&inbuf, &inbytesleft, | ||||
|              &outbuf, &outbytesleft) == (size_t)-1) | ||||
|       { | ||||
|       switch(errno) | ||||
|         { | ||||
|         case E2BIG: | ||||
|           output_pos = (int)(outbuf - ret); | ||||
| 
 | ||||
|           alloc_size   += BYTES_INCREMENT; | ||||
|           outbytesleft += BYTES_INCREMENT; | ||||
| 
 | ||||
|           ret = realloc(ret, alloc_size); | ||||
|           if (ret == NULL) | ||||
|             { | ||||
|             cdio_warn("Can't realloc(%d).", alloc_size); | ||||
|             return false; | ||||
|             } | ||||
|           outbuf = ret + output_pos; | ||||
|           break; | ||||
|         default: | ||||
|           cdio_warn("Iconv failed: %s", strerror(errno)); | ||||
|           if (ret != NULL) | ||||
|             free(ret); | ||||
|           return false; | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|     if(!inbytesleft) | ||||
|       break; | ||||
|     } | ||||
|   /* Zero terminate */ | ||||
|   *outbuf = '\0'; | ||||
| 
 | ||||
|   /* Set return values */ | ||||
|   *dst = ret; | ||||
|   if(dst_len) | ||||
|     *dst_len = (int)(outbuf - ret); | ||||
| #if 0 | ||||
|   fprintf(stderr, "Conversion done, src:\n"); | ||||
|   bgav_hexdump(src, src_len, 16); | ||||
|   fprintf(stderr, "dst:\n"); | ||||
|   bgav_hexdump((uint8_t*)(ret), (int)(outbuf - ret), 16); | ||||
| #endif   | ||||
|   return true; | ||||
|   } | ||||
| 
 | ||||
| bool cdio_charset_convert(cdio_charset_coverter_t*cnv, | ||||
|                           char * src, int src_len, | ||||
|                           char ** dst, int * dst_len) | ||||
|   { | ||||
|   return do_convert(cnv->ic, src, src_len, dst, dst_len); | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst, | ||||
|                             int * dst_len, const char * dst_charset) | ||||
|   { | ||||
|   iconv_t ic; | ||||
|   bool result; | ||||
|   ic = iconv_open(dst_charset, "UTF-8"); | ||||
|   result = do_convert(ic, src, -1, dst, dst_len); | ||||
|   iconv_close(ic); | ||||
|   return result; | ||||
|   } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst, | ||||
|                           const char * src_charset) | ||||
|   { | ||||
|   iconv_t ic; | ||||
|   bool result; | ||||
|   ic = iconv_open("UTF-8", src_charset); | ||||
|   result = do_convert(ic, src, src_len, dst, NULL); | ||||
|   iconv_close(ic); | ||||
|   return result; | ||||
|   } | ||||
| #elif defined(_WIN32) | ||||
| #include <windows.h> | ||||
| 
 | ||||
| #define wchar_to_utf8_no_alloc(wsrc, dest, dest_size) \ | ||||
| 	WideCharToMultiByte(CP_UTF8, 0, wsrc, -1, dest, dest_size, NULL, NULL) | ||||
| #define utf8_to_wchar_no_alloc(src, wdest, wdest_size) \ | ||||
| 	MultiByteToWideChar(CP_UTF8, 0, src, -1, wdest, wdest_size) | ||||
| 
 | ||||
| /*
 | ||||
|  * Converts an UTF-16 string to UTF8 (allocate returned string) | ||||
|  * Returns NULL on error | ||||
|  */ | ||||
| static __inline char* wchar_to_utf8(const wchar_t* wstr) | ||||
| { | ||||
| 	int size = 0; | ||||
| 	char* str = NULL; | ||||
| 
 | ||||
| 	/* Find out the size we need to allocate for our converted string */ | ||||
| 	size = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL); | ||||
| 	if (size <= 1)	// An empty string would be size 1
 | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	if ((str = (char*)calloc(size, 1)) == NULL) | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	if (wchar_to_utf8_no_alloc(wstr, str, size) != size) { | ||||
| 		free(str); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 
 | ||||
| 	return str; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Converts an UTF8 string to UTF-16 (allocate returned string) | ||||
|  * Returns NULL on error | ||||
|  */ | ||||
| static __inline wchar_t* utf8_to_wchar(const char* str) | ||||
| { | ||||
| 	int size = 0; | ||||
| 	wchar_t* wstr = NULL; | ||||
| 
 | ||||
| 	/* Find out the size we need to allocate for our converted string */ | ||||
| 	size = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); | ||||
| 	if (size <= 1)	// An empty string would be size 1
 | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	if ((wstr = (wchar_t*)calloc(size, sizeof(wchar_t))) == NULL) | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	if (utf8_to_wchar_no_alloc(str, wstr, size) != size) { | ||||
| 		free(wstr); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	return wstr; | ||||
| } | ||||
| 
 | ||||
| bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst, | ||||
|                           const char * src_charset) | ||||
| { | ||||
| 	wchar_t* le_src; | ||||
| 
 | ||||
| 	if (src == NULL || dst == NULL || src_charset == NULL || strcmp(src_charset, "UCS-2BE") != 0) | ||||
| 		return false; | ||||
| 
 | ||||
| 	if (src_len == (size_t)-1) { | ||||
| 		for (src_len = 0; ((uint16_t*)src)[src_len] !=0; src_len++); | ||||
| 		src_len <<=2; | ||||
| 	} | ||||
| 
 | ||||
| 	/* zero lenght is a headache (LCMapString doesn't support it)
 | ||||
| 	   => eliminate this case first */ | ||||
| 	if (src_len == 0) { | ||||
| 		*dst = (cdio_utf8_t*)malloc(1); | ||||
| 		*dst[0] = 0; | ||||
| 		return true; | ||||
| 	} | ||||
| 
 | ||||
| 	le_src = (wchar_t*)malloc(src_len+2); | ||||
| 	/* WideCharToMultiByte only takes UCS-2LE, and we are fed UCS-2BE 
 | ||||
| 	   => perform byte reversal */ | ||||
| 	LCMapStringW(0, LCMAP_BYTEREV, (LPCWSTR)src, src_len, le_src, src_len); | ||||
| 	*dst = wchar_to_utf8(le_src); | ||||
| 	free(le_src); | ||||
| 
 | ||||
| 	return (*dst != NULL); | ||||
| } | ||||
| #endif /* HAVE_ICONV */ | ||||
| 
 | ||||
| #endif /* HAVE_JOLIET */ | ||||
							
								
								
									
										163
									
								
								src/libcdio/driver/util.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								src/libcdio/driver/util.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,163 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010, 2011 | ||||
|   Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <ctype.h> | ||||
| #ifdef HAVE_STDLIB_H | ||||
| #include <stdlib.h> | ||||
| #endif | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_INTTYPES_H | ||||
| #include "inttypes.h" | ||||
| #endif | ||||
| 
 | ||||
| #include "cdio_assert.h" | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/util.h> | ||||
| #include <cdio/version.h> | ||||
| 
 | ||||
| size_t | ||||
| _cdio_strlenv(char **str_array) | ||||
| { | ||||
|   size_t n = 0; | ||||
| 
 | ||||
|   cdio_assert (str_array != NULL); | ||||
| 
 | ||||
|   while(str_array[n]) | ||||
|     n++; | ||||
| 
 | ||||
|   return n; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| _cdio_strfreev(char **strv) | ||||
| { | ||||
|   int n; | ||||
|    | ||||
|   cdio_assert (strv != NULL); | ||||
| 
 | ||||
|   for(n = 0; strv[n]; n++) | ||||
|     free(strv[n]); | ||||
| 
 | ||||
|   free(strv); | ||||
| } | ||||
| 
 | ||||
| char ** | ||||
| _cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */ | ||||
| { | ||||
|   int n; | ||||
|   char **strv = NULL; | ||||
|   char *_str, *p; | ||||
|   char _delim[2] = { 0, 0 }; | ||||
| 
 | ||||
|   cdio_assert (str != NULL); | ||||
| 
 | ||||
|   _str = strdup(str); | ||||
|   _delim[0] = delim; | ||||
| 
 | ||||
|   cdio_assert (_str != NULL); | ||||
| 
 | ||||
|   n = 1; | ||||
|   p = _str; | ||||
|   while(*p)  | ||||
|     if (*(p++) == delim) | ||||
|       n++; | ||||
| 
 | ||||
|   strv = calloc (1, sizeof (char *) * (n+1)); | ||||
|    | ||||
|   n = 0; | ||||
|   while((p = strtok(n ? NULL : _str, _delim)) != NULL)  | ||||
|     strv[n++] = strdup(p); | ||||
| 
 | ||||
|   free(_str); | ||||
| 
 | ||||
|   return strv; | ||||
| } | ||||
| 
 | ||||
| void * | ||||
| _cdio_memdup (const void *mem, size_t count) | ||||
| { | ||||
|   void *new_mem = NULL; | ||||
| 
 | ||||
|   if (mem) | ||||
|     { | ||||
|       new_mem = calloc (1, count); | ||||
|       memcpy (new_mem, mem, count); | ||||
|     } | ||||
|    | ||||
|   return new_mem; | ||||
| } | ||||
| 
 | ||||
| char * | ||||
| _cdio_strdup_upper (const char str[]) | ||||
| { | ||||
|   char *new_str = NULL; | ||||
| 
 | ||||
|   if (str) | ||||
|     { | ||||
|       char *p; | ||||
| 
 | ||||
|       p = new_str = strdup (str); | ||||
| 
 | ||||
|       while (*p) | ||||
|         { | ||||
|           *p = toupper (*p); | ||||
|           p++; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|   return new_str; | ||||
| } | ||||
| 
 | ||||
| uint8_t | ||||
| cdio_to_bcd8 (uint8_t n) | ||||
| { | ||||
|   /*cdio_assert (n < 100);*/ | ||||
| 
 | ||||
|   return ((n/10)<<4) | (n%10); | ||||
| } | ||||
| 
 | ||||
| uint8_t | ||||
| cdio_from_bcd8(uint8_t p) | ||||
| { | ||||
|   return (0xf & p)+(10*(p >> 4)); | ||||
| } | ||||
| 
 | ||||
| const char *cdio_version_string = CDIO_VERSION; | ||||
| const unsigned int libcdio_version_num = LIBCDIO_VERSION_NUM; | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										180
									
								
								src/libcdio/iso9660/.msvc/iso9660.vcxproj
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										180
									
								
								src/libcdio/iso9660/.msvc/iso9660.vcxproj
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,180 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\..\cdio\bytesex.h" /> | ||||
|     <ClInclude Include="..\..\cdio\cdio.h" /> | ||||
|     <ClInclude Include="..\..\cdio\iso9660.h" /> | ||||
|     <ClInclude Include="..\..\cdio\logging.h" /> | ||||
|     <ClInclude Include="..\..\cdio\utf8.h" /> | ||||
|     <ClInclude Include="..\..\cdio\util.h" /> | ||||
|     <ClInclude Include="..\..\config.h" /> | ||||
|     <ClInclude Include="..\..\driver\cdio_assert.h" /> | ||||
|     <ClInclude Include="..\..\driver\cdio_private.h" /> | ||||
|     <ClInclude Include="..\..\driver\filemode.h" /> | ||||
|     <ClInclude Include="..\..\driver\_cdio_stdio.h" /> | ||||
|     <ClInclude Include="..\iso9660_private.h" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\iso9660.c" /> | ||||
|     <ClCompile Include="..\iso9660_fs.c" /> | ||||
|     <ClCompile Include="..\rock.c" /> | ||||
|     <ClCompile Include="..\xa.c" /> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>{D4E80F35-2604-40AC-B436-97B052ECB572}</ProjectGuid> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <RootNamespace>iso9660</RootNamespace> | ||||
|     <ProjectName>libcdio-iso9660</ProjectName> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup> | ||||
|     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										65
									
								
								src/libcdio/iso9660/.msvc/iso9660.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/libcdio/iso9660/.msvc/iso9660.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,65 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="Source Files"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="Header Files"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\iso9660_private.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\config.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\cdio_assert.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\bytesex.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\iso9660.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\util.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\cdio.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\utf8.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\_cdio_stdio.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\cdio_private.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\logging.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\filemode.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\iso9660_fs.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\rock.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\xa.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\iso9660.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										19
									
								
								src/libcdio/iso9660/.msvc/iso9660_sources
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/libcdio/iso9660/.msvc/iso9660_sources
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| TARGETNAME=iso9660 | ||||
| TARGETTYPE=LIBRARY | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.;..;..\driver;..\..\msvc-missing | ||||
| LIBCDIO_DEFINES = /DHAVE_CONFIG_H /D_OFF_T_DEFINED /D_off_t=__int64 /Doff_t=_off_t /D_FILE_OFFSET_BITS=64 | ||||
| C_DEFINES=$(C_DEFINES) $(LIBCDIO_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
| MSC_WARNING_LEVEL=/W3 | ||||
| !ENDIF | ||||
| USE_MSVCRT=1 | ||||
| 
 | ||||
| TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ | ||||
|            $(SDK_LIB_PATH)\user32.lib | ||||
| 
 | ||||
| SOURCES=iso9660.c    \ | ||||
| 	iso9660_fs.c       \ | ||||
| 	rock.c             \ | ||||
| 	xa.c | ||||
							
								
								
									
										4
									
								
								src/libcdio/iso9660/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/libcdio/iso9660/Makefile.am
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| noinst_LIBRARIES = libiso9660.a | ||||
| libiso9660_a_SOURCES = iso9660.c iso9660_fs.c rock.c xa.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang! | ||||
| libiso9660_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. -I../driver | ||||
							
								
								
									
										425
									
								
								src/libcdio/iso9660/Makefile.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										425
									
								
								src/libcdio/iso9660/Makefile.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,425 @@ | |||
| # Makefile.in generated by automake 1.11.1 from Makefile.am.
 | ||||
| # @configure_input@
 | ||||
| 
 | ||||
| # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 | ||||
| # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
 | ||||
| # Inc.
 | ||||
| # This Makefile.in is free software; the Free Software Foundation
 | ||||
| # gives unlimited permission to copy and/or distribute it,
 | ||||
| # with or without modifications, as long as this notice is preserved.
 | ||||
| 
 | ||||
| # This program is distributed in the hope that it will be useful,
 | ||||
| # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 | ||||
| # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 | ||||
| # PARTICULAR PURPOSE.
 | ||||
| 
 | ||||
| @SET_MAKE@ | ||||
| 
 | ||||
| VPATH = @srcdir@ | ||||
| pkgdatadir = $(datadir)/@PACKAGE@ | ||||
| pkgincludedir = $(includedir)/@PACKAGE@ | ||||
| pkglibdir = $(libdir)/@PACKAGE@ | ||||
| pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||||
| am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||||
| install_sh_DATA = $(install_sh) -c -m 644 | ||||
| install_sh_PROGRAM = $(install_sh) -c | ||||
| install_sh_SCRIPT = $(install_sh) -c | ||||
| INSTALL_HEADER = $(INSTALL_DATA) | ||||
| transform = $(program_transform_name) | ||||
| NORMAL_INSTALL = : | ||||
| PRE_INSTALL = : | ||||
| POST_INSTALL = : | ||||
| NORMAL_UNINSTALL = : | ||||
| PRE_UNINSTALL = : | ||||
| POST_UNINSTALL = : | ||||
| subdir = src/libcdio/iso9660 | ||||
| DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am | ||||
| ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||||
| am__aclocal_m4_deps = $(top_srcdir)/configure.ac | ||||
| am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 | ||||
| 	$(ACLOCAL_M4) | ||||
| mkinstalldirs = $(install_sh) -d | ||||
| CONFIG_CLEAN_FILES = | ||||
| CONFIG_CLEAN_VPATH_FILES = | ||||
| LIBRARIES = $(noinst_LIBRARIES) | ||||
| AR = ar | ||||
| ARFLAGS = cru | ||||
| AM_V_AR = $(am__v_AR_$(V)) | ||||
| am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_AR_0 = @echo "  AR    " $@; | ||||
| AM_V_at = $(am__v_at_$(V)) | ||||
| am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_at_0 = @ | ||||
| libiso9660_a_AR = $(AR) $(ARFLAGS) | ||||
| libiso9660_a_LIBADD = | ||||
| am_libiso9660_a_OBJECTS = libiso9660_a-iso9660.$(OBJEXT) \
 | ||||
| 	libiso9660_a-iso9660_fs.$(OBJEXT) libiso9660_a-rock.$(OBJEXT) \
 | ||||
| 	libiso9660_a-xa.$(OBJEXT) | ||||
| libiso9660_a_OBJECTS = $(am_libiso9660_a_OBJECTS) | ||||
| DEFAULT_INCLUDES = -I.@am__isrc@ | ||||
| depcomp = | ||||
| am__depfiles_maybe = | ||||
| AM_V_lt = $(am__v_lt_$(V)) | ||||
| am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_lt_0 = --silent | ||||
| COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 | ||||
| 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||
| AM_V_CC = $(am__v_CC_$(V)) | ||||
| am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CC_0 = @echo "  CC    " $@; | ||||
| CCLD = $(CC) | ||||
| LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||||
| AM_V_CCLD = $(am__v_CCLD_$(V)) | ||||
| am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CCLD_0 = @echo "  CCLD  " $@; | ||||
| AM_V_GEN = $(am__v_GEN_$(V)) | ||||
| am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_GEN_0 = @echo "  GEN   " $@; | ||||
| SOURCES = $(libiso9660_a_SOURCES) | ||||
| ETAGS = etags | ||||
| CTAGS = ctags | ||||
| ACLOCAL = @ACLOCAL@ | ||||
| AMTAR = @AMTAR@ | ||||
| AM_CFLAGS = @AM_CFLAGS@ | ||||
| AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||||
| AM_LDFLAGS = @AM_LDFLAGS@ | ||||
| AM_RCFLAGS = @AM_RCFLAGS@ | ||||
| AUTOCONF = @AUTOCONF@ | ||||
| AUTOHEADER = @AUTOHEADER@ | ||||
| AUTOMAKE = @AUTOMAKE@ | ||||
| AWK = @AWK@ | ||||
| CC = @CC@ | ||||
| CFLAGS = @CFLAGS@ | ||||
| CPPFLAGS = @CPPFLAGS@ | ||||
| CYGPATH_W = @CYGPATH_W@ | ||||
| DEFS = @DEFS@ | ||||
| ECHO_C = @ECHO_C@ | ||||
| ECHO_N = @ECHO_N@ | ||||
| ECHO_T = @ECHO_T@ | ||||
| EXEEXT = @EXEEXT@ | ||||
| EXESUFFIX = @EXESUFFIX@ | ||||
| INSTALL = @INSTALL@ | ||||
| INSTALL_DATA = @INSTALL_DATA@ | ||||
| INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||||
| INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||||
| INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||||
| LDFLAGS = @LDFLAGS@ | ||||
| LIBOBJS = @LIBOBJS@ | ||||
| LIBS = @LIBS@ | ||||
| LTLIBOBJS = @LTLIBOBJS@ | ||||
| MAKEINFO = @MAKEINFO@ | ||||
| MKDIR_P = @MKDIR_P@ | ||||
| OBJEXT = @OBJEXT@ | ||||
| PACKAGE = @PACKAGE@ | ||||
| PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||||
| PACKAGE_NAME = @PACKAGE_NAME@ | ||||
| PACKAGE_STRING = @PACKAGE_STRING@ | ||||
| PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||||
| PACKAGE_URL = @PACKAGE_URL@ | ||||
| PACKAGE_VERSION = @PACKAGE_VERSION@ | ||||
| PATH_SEPARATOR = @PATH_SEPARATOR@ | ||||
| RANLIB = @RANLIB@ | ||||
| RM = @RM@ | ||||
| SET_MAKE = @SET_MAKE@ | ||||
| SHELL = @SHELL@ | ||||
| STRIP = @STRIP@ | ||||
| VERSION = @VERSION@ | ||||
| VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@ | ||||
| WINDRES = @WINDRES@ | ||||
| abs_builddir = @abs_builddir@ | ||||
| abs_srcdir = @abs_srcdir@ | ||||
| abs_top_builddir = @abs_top_builddir@ | ||||
| abs_top_srcdir = @abs_top_srcdir@ | ||||
| ac_ct_CC = @ac_ct_CC@ | ||||
| am__leading_dot = @am__leading_dot@ | ||||
| am__tar = @am__tar@ | ||||
| am__untar = @am__untar@ | ||||
| bindir = @bindir@ | ||||
| build_alias = @build_alias@ | ||||
| builddir = @builddir@ | ||||
| datadir = @datadir@ | ||||
| datarootdir = @datarootdir@ | ||||
| docdir = @docdir@ | ||||
| dvidir = @dvidir@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| host_alias = @host_alias@ | ||||
| htmldir = @htmldir@ | ||||
| includedir = @includedir@ | ||||
| infodir = @infodir@ | ||||
| install_sh = @install_sh@ | ||||
| libdir = @libdir@ | ||||
| libexecdir = @libexecdir@ | ||||
| localedir = @localedir@ | ||||
| localstatedir = @localstatedir@ | ||||
| mandir = @mandir@ | ||||
| mkdir_p = @mkdir_p@ | ||||
| oldincludedir = @oldincludedir@ | ||||
| pdfdir = @pdfdir@ | ||||
| prefix = @prefix@ | ||||
| program_transform_name = @program_transform_name@ | ||||
| psdir = @psdir@ | ||||
| sbindir = @sbindir@ | ||||
| sharedstatedir = @sharedstatedir@ | ||||
| srcdir = @srcdir@ | ||||
| sysconfdir = @sysconfdir@ | ||||
| target_alias = @target_alias@ | ||||
| top_build_prefix = @top_build_prefix@ | ||||
| top_builddir = @top_builddir@ | ||||
| top_srcdir = @top_srcdir@ | ||||
| noinst_LIBRARIES = libiso9660.a | ||||
| libiso9660_a_SOURCES = iso9660.c iso9660_fs.c rock.c xa.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang!
 | ||||
| libiso9660_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. -I../driver | ||||
| all: all-am | ||||
| 
 | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c .o .obj | ||||
| $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps) | ||||
| 	@for dep in $?; do \
 | ||||
| 	  case '$(am__configure_deps)' in \
 | ||||
| 	    *$$dep*) \
 | ||||
| 	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
 | ||||
| 	        && { if test -f $@; then exit 0; else break; fi; }; \
 | ||||
| 	      exit 1;; \
 | ||||
| 	  esac; \
 | ||||
| 	done; \
 | ||||
| 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/libcdio/iso9660/Makefile'; \
 | ||||
| 	$(am__cd) $(top_srcdir) && \
 | ||||
| 	  $(AUTOMAKE) --foreign --ignore-deps src/libcdio/iso9660/Makefile | ||||
| .PRECIOUS: Makefile | ||||
| Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||||
| 	@case '$?' in \
 | ||||
| 	  *config.status*) \
 | ||||
| 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 | ||||
| 	  *) \
 | ||||
| 	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
 | ||||
| 	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
 | ||||
| 	esac; | ||||
| 
 | ||||
| $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| 
 | ||||
| $(top_srcdir)/configure:  $(am__configure_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(ACLOCAL_M4):  $(am__aclocal_m4_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(am__aclocal_m4_deps): | ||||
| 
 | ||||
| clean-noinstLIBRARIES: | ||||
| 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) | ||||
| libiso9660.a: $(libiso9660_a_OBJECTS) $(libiso9660_a_DEPENDENCIES)  | ||||
| 	$(AM_V_at)-rm -f libiso9660.a | ||||
| 	$(AM_V_AR)$(libiso9660_a_AR) libiso9660.a $(libiso9660_a_OBJECTS) $(libiso9660_a_LIBADD) | ||||
| 	$(AM_V_at)$(RANLIB) libiso9660.a | ||||
| 
 | ||||
| mostlyclean-compile: | ||||
| 	-rm -f *.$(OBJEXT) | ||||
| 
 | ||||
| distclean-compile: | ||||
| 	-rm -f *.tab.c | ||||
| 
 | ||||
| .c.o: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c $< | ||||
| 
 | ||||
| .c.obj: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c `$(CYGPATH_W) '$<'` | ||||
| 
 | ||||
| libiso9660_a-iso9660.o: iso9660.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-iso9660.o `test -f 'iso9660.c' || echo '$(srcdir)/'`iso9660.c | ||||
| 
 | ||||
| libiso9660_a-iso9660.obj: iso9660.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-iso9660.obj `if test -f 'iso9660.c'; then $(CYGPATH_W) 'iso9660.c'; else $(CYGPATH_W) '$(srcdir)/iso9660.c'; fi` | ||||
| 
 | ||||
| libiso9660_a-iso9660_fs.o: iso9660_fs.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-iso9660_fs.o `test -f 'iso9660_fs.c' || echo '$(srcdir)/'`iso9660_fs.c | ||||
| 
 | ||||
| libiso9660_a-iso9660_fs.obj: iso9660_fs.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-iso9660_fs.obj `if test -f 'iso9660_fs.c'; then $(CYGPATH_W) 'iso9660_fs.c'; else $(CYGPATH_W) '$(srcdir)/iso9660_fs.c'; fi` | ||||
| 
 | ||||
| libiso9660_a-rock.o: rock.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-rock.o `test -f 'rock.c' || echo '$(srcdir)/'`rock.c | ||||
| 
 | ||||
| libiso9660_a-rock.obj: rock.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-rock.obj `if test -f 'rock.c'; then $(CYGPATH_W) 'rock.c'; else $(CYGPATH_W) '$(srcdir)/rock.c'; fi` | ||||
| 
 | ||||
| libiso9660_a-xa.o: xa.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-xa.o `test -f 'xa.c' || echo '$(srcdir)/'`xa.c | ||||
| 
 | ||||
| libiso9660_a-xa.obj: xa.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libiso9660_a_CFLAGS) $(CFLAGS) -c -o libiso9660_a-xa.obj `if test -f 'xa.c'; then $(CYGPATH_W) 'xa.c'; else $(CYGPATH_W) '$(srcdir)/xa.c'; fi` | ||||
| 
 | ||||
| ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||||
| 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	mkid -fID $$unique | ||||
| tags: TAGS | ||||
| 
 | ||||
| TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	set x; \
 | ||||
| 	here=`pwd`; \
 | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	shift; \
 | ||||
| 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 | ||||
| 	  test -n "$$unique" || unique=$$empty_fix; \
 | ||||
| 	  if test $$# -gt 0; then \ | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      "$$@" $$unique; \
 | ||||
| 	  else \
 | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      $$unique; \
 | ||||
| 	  fi; \
 | ||||
| 	fi | ||||
| ctags: CTAGS | ||||
| CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	test -z "$(CTAGS_ARGS)$$unique" \
 | ||||
| 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 | ||||
| 	     $$unique | ||||
| 
 | ||||
| GTAGS: | ||||
| 	here=`$(am__cd) $(top_builddir) && pwd` \
 | ||||
| 	  && $(am__cd) $(top_srcdir) \
 | ||||
| 	  && gtags -i $(GTAGS_ARGS) "$$here" | ||||
| 
 | ||||
| distclean-tags: | ||||
| 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||||
| check-am: all-am | ||||
| check: check-am | ||||
| all-am: Makefile $(LIBRARIES) | ||||
| installdirs: | ||||
| install: install-am | ||||
| install-exec: install-exec-am | ||||
| install-data: install-data-am | ||||
| uninstall: uninstall-am | ||||
| 
 | ||||
| install-am: all-am | ||||
| 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||||
| 
 | ||||
| installcheck: installcheck-am | ||||
| install-strip: | ||||
| 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
 | ||||
| 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
 | ||||
| 	  `test -z '$(STRIP)' || \
 | ||||
| 	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||||
| mostlyclean-generic: | ||||
| 
 | ||||
| clean-generic: | ||||
| 
 | ||||
| distclean-generic: | ||||
| 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||||
| 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||||
| 
 | ||||
| maintainer-clean-generic: | ||||
| 	@echo "This command is intended for maintainers to use" | ||||
| 	@echo "it deletes files that may require special tools to rebuild." | ||||
| clean: clean-am | ||||
| 
 | ||||
| clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am | ||||
| 
 | ||||
| distclean: distclean-am | ||||
| 	-rm -f Makefile | ||||
| distclean-am: clean-am distclean-compile distclean-generic \ | ||||
| 	distclean-tags | ||||
| 
 | ||||
| dvi: dvi-am | ||||
| 
 | ||||
| dvi-am: | ||||
| 
 | ||||
| html: html-am | ||||
| 
 | ||||
| html-am: | ||||
| 
 | ||||
| info: info-am | ||||
| 
 | ||||
| info-am: | ||||
| 
 | ||||
| install-data-am: | ||||
| 
 | ||||
| install-dvi: install-dvi-am | ||||
| 
 | ||||
| install-dvi-am: | ||||
| 
 | ||||
| install-exec-am: | ||||
| 
 | ||||
| install-html: install-html-am | ||||
| 
 | ||||
| install-html-am: | ||||
| 
 | ||||
| install-info: install-info-am | ||||
| 
 | ||||
| install-info-am: | ||||
| 
 | ||||
| install-man: | ||||
| 
 | ||||
| install-pdf: install-pdf-am | ||||
| 
 | ||||
| install-pdf-am: | ||||
| 
 | ||||
| install-ps: install-ps-am | ||||
| 
 | ||||
| install-ps-am: | ||||
| 
 | ||||
| installcheck-am: | ||||
| 
 | ||||
| maintainer-clean: maintainer-clean-am | ||||
| 	-rm -f Makefile | ||||
| maintainer-clean-am: distclean-am maintainer-clean-generic | ||||
| 
 | ||||
| mostlyclean: mostlyclean-am | ||||
| 
 | ||||
| mostlyclean-am: mostlyclean-compile mostlyclean-generic | ||||
| 
 | ||||
| pdf: pdf-am | ||||
| 
 | ||||
| pdf-am: | ||||
| 
 | ||||
| ps: ps-am | ||||
| 
 | ||||
| ps-am: | ||||
| 
 | ||||
| uninstall-am: | ||||
| 
 | ||||
| .MAKE: install-am install-strip | ||||
| 
 | ||||
| .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||||
| 	clean-noinstLIBRARIES ctags distclean distclean-compile \
 | ||||
| 	distclean-generic distclean-tags dvi dvi-am html html-am info \
 | ||||
| 	info-am install install-am install-data install-data-am \
 | ||||
| 	install-dvi install-dvi-am install-exec install-exec-am \
 | ||||
| 	install-html install-html-am install-info install-info-am \
 | ||||
| 	install-man install-pdf install-pdf-am install-ps \
 | ||||
| 	install-ps-am install-strip installcheck installcheck-am \
 | ||||
| 	installdirs maintainer-clean maintainer-clean-generic \
 | ||||
| 	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
 | ||||
| 	ps ps-am tags uninstall uninstall-am | ||||
| 
 | ||||
| 
 | ||||
| # Tell versions [3.59,3.63) of GNU make to not export all variables.
 | ||||
| # Otherwise a system limit (for SysV at least) may be exceeded.
 | ||||
| .NOEXPORT: | ||||
							
								
								
									
										1268
									
								
								src/libcdio/iso9660/iso9660.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1268
									
								
								src/libcdio/iso9660/iso9660.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1541
									
								
								src/libcdio/iso9660/iso9660_fs.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1541
									
								
								src/libcdio/iso9660/iso9660_fs.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										83
									
								
								src/libcdio/iso9660/iso9660_private.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/libcdio/iso9660/iso9660_private.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2004, 2005, 2008, 2011 | ||||
|   Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   See also iso9660.h by Eric Youngdale (1993). | ||||
| 
 | ||||
|   Copyright 1993 Yggdrasil Computing, Incorporated | ||||
|   Copyright (c) 1999,2000 J. Schilling | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| #ifndef __CDIO_ISO9660_PRIVATE_H__ | ||||
| #define __CDIO_ISO9660_PRIVATE_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #define ISO_VERSION             1 | ||||
| 
 | ||||
| PRAGMA_BEGIN_PACKED | ||||
| 
 | ||||
| typedef struct iso_volume_descriptor_s { | ||||
|   uint8_t  type;      /**< 7.1.1 */ | ||||
|   char     id[5];     /**< "CD001" (ISO_STANDARD_ID) */ | ||||
|   uint8_t  version;   /**< 7.1.1 */ | ||||
|   char     data[2041]; | ||||
| }  GNUC_PACKED iso_volume_descriptor_t; | ||||
| 
 | ||||
| #define iso_volume_descriptor_t_SIZEOF ISO_BLOCKSIZE | ||||
| 
 | ||||
| #define iso9660_pvd_t_SIZEOF ISO_BLOCKSIZE | ||||
| 
 | ||||
| /*
 | ||||
|  * XXX JS: The next structure has an odd length! | ||||
|  * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length. | ||||
|  * For this reason, we cannot use sizeof (struct iso_path_table) or | ||||
|  * sizeof (struct iso_directory_record) to compute on disk sizes. | ||||
|  * Instead, we use offsetof(..., name) and add the name size. | ||||
|  * See mkisofs.h | ||||
|  */ | ||||
| 
 | ||||
| /** We use this to help us look up the parent inode numbers. */ | ||||
| typedef struct iso_path_table_s { | ||||
|   uint8_t  name_len; /**< 7.1.1 */ | ||||
|   uint8_t  xa_len;   /**< 7.1.1 */ | ||||
|   uint32_t extent;   /**< 7.3.1/7.3.2 */ | ||||
|   uint16_t parent;   /**< 7.2.1/7.2.2 */ | ||||
|   char     name[EMPTY_ARRAY_SIZE]; | ||||
| } GNUC_PACKED iso_path_table_t; | ||||
| 
 | ||||
| #define iso_path_table_t_SIZEOF 8 | ||||
| 
 | ||||
| #define iso9660_dir_t_SIZEOF 33 | ||||
| 
 | ||||
| PRAGMA_END_PACKED | ||||
| 
 | ||||
| #endif /* __CDIO_ISO9660_PRIVATE_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										619
									
								
								src/libcdio/iso9660/rock.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										619
									
								
								src/libcdio/iso9660/rock.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,619 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2008, 2010, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Adapted from GNU/Linux fs/isofs/rock.c (C) 1992, 1993 Eric Youngdale | ||||
|   | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /* Rock Ridge Extensions to iso9660 */ | ||||
| 
 | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| # include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDLIB_H | ||||
| # include <stdlib.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| # include <sys/stat.h> | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/iso9660.h> | ||||
| #include <cdio/logging.h> | ||||
| #include <cdio/bytesex.h> | ||||
| #include "filemode.h" | ||||
| 
 | ||||
| #define CDIO_MKDEV(ma,mi)	((ma)<<16 | (mi)) | ||||
| 
 | ||||
| enum iso_rock_enums iso_rock_enums; | ||||
| iso_rock_nm_flag_t iso_rock_nm_flag; | ||||
| iso_rock_sl_flag_t iso_rock_sl_flag; | ||||
| iso_rock_tf_flag_t iso_rock_tf_flag; | ||||
| 
 | ||||
| /* Our own realloc routine tailored for the iso9660_stat_t symlink
 | ||||
|    field.  I can't figure out how to make realloc() work without | ||||
|    valgrind complaint. | ||||
| */ | ||||
| static bool | ||||
| realloc_symlink(/*in/out*/ iso9660_stat_t *p_stat, uint8_t i_grow)  | ||||
| { | ||||
|   if (!p_stat->rr.i_symlink) { | ||||
|     const uint16_t i_max = 2*i_grow+1; | ||||
|     p_stat->rr.psz_symlink = (char *) calloc(1, i_max); | ||||
|     p_stat->rr.i_symlink_max = i_max; | ||||
|     return (NULL != p_stat->rr.psz_symlink); | ||||
|   } else { | ||||
|     unsigned int i_needed = p_stat->rr.i_symlink + i_grow ; | ||||
|     if ( i_needed <= p_stat->rr.i_symlink_max) | ||||
|       return true; | ||||
|     else { | ||||
|       char * psz_newsymlink = (char *) calloc(1, 2*i_needed); | ||||
|       if (!psz_newsymlink) return false; | ||||
|       p_stat->rr.i_symlink_max = 2*i_needed; | ||||
|       memcpy(psz_newsymlink, p_stat->rr.psz_symlink, p_stat->rr.i_symlink); | ||||
|       free(p_stat->rr.psz_symlink); | ||||
|       p_stat->rr.psz_symlink = psz_newsymlink; | ||||
|       return true; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /* These functions are designed to read the system areas of a directory record
 | ||||
|  * and extract relevant information.  There are different functions provided | ||||
|  * depending upon what information we need at the time.  One function fills | ||||
|  * out an inode structure, a second one extracts a filename, a third one | ||||
|  * returns a symbolic link name, and a fourth one returns the extent number | ||||
|  * for the file. */ | ||||
| 
 | ||||
| #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ | ||||
| 
 | ||||
| 
 | ||||
| /* This is a way of ensuring that we have something in the system
 | ||||
|    use fields that is compatible with Rock Ridge */ | ||||
| #define CHECK_SP(FAIL)	       			\ | ||||
|       if(rr->u.SP.magic[0] != 0xbe) FAIL;	\ | ||||
|       if(rr->u.SP.magic[1] != 0xef) FAIL;       \ | ||||
|       p_stat->rr.s_rock_offset = rr->u.SP.skip; | ||||
| /* We define a series of macros because each function must do exactly the
 | ||||
|    same thing in certain places.  We use the macros to ensure that everything | ||||
|    is done correctly */ | ||||
| 
 | ||||
| #define CONTINUE_DECLS \ | ||||
|   int cont_extent = 0, cont_offset = 0, cont_size = 0;   \ | ||||
|   void *buffer = NULL | ||||
| 
 | ||||
| #define CHECK_CE				 \ | ||||
|   { cont_extent = from_733(*rr->u.CE.extent);	 \ | ||||
|     cont_offset = from_733(*rr->u.CE.offset);	 \ | ||||
|     cont_size = from_733(*rr->u.CE.size);        \ | ||||
|     (void)cont_extent; (void)cont_offset, (void)cont_size; } | ||||
| 
 | ||||
| #define SETUP_ROCK_RIDGE(DE,CHR,LEN)	      		      	\ | ||||
|   {								\ | ||||
|     LEN= sizeof(iso9660_dir_t) + DE->filename.len;		\ | ||||
|     if(LEN & 1) LEN++;						\ | ||||
|     CHR = ((unsigned char *) DE) + LEN;				\ | ||||
|     LEN = *((unsigned char *) DE) - LEN;			\ | ||||
|     if (0xff != p_stat->rr.s_rock_offset)			\ | ||||
|       {								\ | ||||
| 	LEN -= p_stat->rr.s_rock_offset;		       	\ | ||||
| 	CHR += p_stat->rr.s_rock_offset;		       	\ | ||||
| 	if (LEN<0) LEN=0;					\ | ||||
|       }								\ | ||||
|   } | ||||
| 
 | ||||
| /* Copy a long or short time from the iso_rock_tf_t into
 | ||||
|    the specified field of a iso_rock_statbuf_t. | ||||
|    non-paramater variables are p_stat, rr, and cnt. | ||||
| */ | ||||
| #define add_time(FLAG, TIME_FIELD)				  \ | ||||
|   if (rr->u.TF.flags & FLAG) {					  \ | ||||
|     p_stat->rr.TIME_FIELD.b_used = true;			  \ | ||||
|     p_stat->rr.TIME_FIELD.b_longdate =				  \ | ||||
|       (0 != (rr->u.TF.flags & ISO_ROCK_TF_LONG_FORM));		  \ | ||||
|     if (p_stat->rr.TIME_FIELD.b_longdate) {			  \ | ||||
|       memcpy(&(p_stat->rr.TIME_FIELD.t.ltime),			  \ | ||||
| 	     &(rr->u.TF.time_bytes[cnt]),			  \ | ||||
| 	     sizeof(iso9660_ltime_t)); 				  \ | ||||
|       cnt += sizeof(iso9660_ltime_t);				  \ | ||||
|     } else {							  \ | ||||
|       memcpy(&(p_stat->rr.TIME_FIELD.t.dtime),			  \ | ||||
| 	     &(rr->u.TF.time_bytes[cnt]),			  \ | ||||
| 	     sizeof(iso9660_dtime_t)); 				  \ | ||||
|       cnt += sizeof(iso9660_dtime_t);				  \ | ||||
|     }								  \ | ||||
|   }								   | ||||
| 
 | ||||
| /*! 
 | ||||
|   Get | ||||
|   @return length of name field; 0: not found, -1: to be ignored  | ||||
| */ | ||||
| int  | ||||
| get_rock_ridge_filename(iso9660_dir_t * p_iso9660_dir,  | ||||
| 			/*out*/ char * psz_name,  | ||||
| 			/*in/out*/ iso9660_stat_t *p_stat) | ||||
| { | ||||
|   int len; | ||||
|   unsigned char *chr; | ||||
|   int symlink_len = 0; | ||||
|   CONTINUE_DECLS; | ||||
|   int i_namelen = 0; | ||||
|   int truncate=0; | ||||
| 
 | ||||
|   if (!p_stat || nope == p_stat->rr.b3_rock) return 0; | ||||
|   *psz_name = 0; | ||||
| 
 | ||||
|   SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); | ||||
|   /*repeat:*/ | ||||
|   { | ||||
|     iso_extension_record_t * rr; | ||||
|     int sig; | ||||
|     int rootflag; | ||||
|      | ||||
|     while (len > 1){ /* There may be one byte for padding somewhere */ | ||||
|       rr = (iso_extension_record_t *) chr; | ||||
|       if (rr->len == 0) goto out; /* Something got screwed up here */ | ||||
|       sig = *chr+(*(chr+1) << 8); | ||||
|       chr += rr->len;  | ||||
|       len -= rr->len; | ||||
| 
 | ||||
|       switch(sig){ | ||||
|       case SIG('S','P'): | ||||
| 	CHECK_SP(goto out); | ||||
| 	break; | ||||
|       case SIG('C','E'):  | ||||
| 	{ | ||||
| 	  iso711_t i_fname = from_711(p_iso9660_dir->filename.len); | ||||
| 	  if ('\0' == p_iso9660_dir->filename.str[1] && 1 == i_fname) | ||||
| 	    break; | ||||
| 	  if ('\1' == p_iso9660_dir->filename.str[1] && 1 == i_fname) | ||||
| 	    break; | ||||
| 	} | ||||
| 	CHECK_CE; | ||||
| 	break; | ||||
|       case SIG('E','R'): | ||||
| 	p_stat->rr.b3_rock = yep; | ||||
| 	cdio_debug("ISO 9660 Extensions: "); | ||||
| 	{  | ||||
| 	  int p; | ||||
| 	  for(p=0;p<rr->u.ER.len_id;p++) cdio_debug("%c",rr->u.ER.data[p]); | ||||
| 	} | ||||
| 	break; | ||||
|       case SIG('N','M'): | ||||
| 	/* Alternate name */ | ||||
| 	p_stat->rr.b3_rock = yep; | ||||
| 	if (truncate) break; | ||||
| 	if (rr->u.NM.flags & ISO_ROCK_NM_PARENT) { | ||||
| 	  i_namelen = sizeof(".."); | ||||
| 	  strncat(psz_name, "..", i_namelen); | ||||
| 	} else if (rr->u.NM.flags & ISO_ROCK_NM_CURRENT) { | ||||
| 	  i_namelen = sizeof("."); | ||||
| 	  strncat(psz_name, ".", i_namelen); | ||||
| 	  break; | ||||
| 	} | ||||
| 
 | ||||
| 	if (rr->u.NM.flags & ~1) { | ||||
| 	  cdio_info("Unsupported NM flag settings (%d)",rr->u.NM.flags); | ||||
| 	  break; | ||||
| 	} | ||||
| 	if((strlen(psz_name) + rr->len - 5) >= 254) { | ||||
| 	  truncate = 1; | ||||
| 	  break; | ||||
| 	} | ||||
| 	strncat(psz_name, rr->u.NM.name, rr->len - 5); | ||||
| 	i_namelen += rr->len - 5; | ||||
| 	break; | ||||
|       case SIG('P','X'): | ||||
| 	/* POSIX file attributes */ | ||||
| 	p_stat->rr.st_mode   = from_733(rr->u.PX.st_mode); | ||||
| 	p_stat->rr.st_nlinks = from_733(rr->u.PX.st_nlinks); | ||||
| 	p_stat->rr.st_uid    = from_733(rr->u.PX.st_uid); | ||||
| 	p_stat->rr.st_gid    = from_733(rr->u.PX.st_gid); | ||||
| 	p_stat->rr.b3_rock    = yep; | ||||
| 	break; | ||||
|       case SIG('S','L'): | ||||
| 	{ | ||||
| 	  /* Symbolic link */ | ||||
| 	  uint8_t slen; | ||||
| 	  iso_rock_sl_part_t * p_sl; | ||||
| 	  iso_rock_sl_part_t * p_oldsl; | ||||
| 	  slen = rr->len - 5; | ||||
| 	  p_sl = &rr->u.SL.link; | ||||
| 	  p_stat->rr.i_symlink = symlink_len; | ||||
| 	  while (slen > 1){ | ||||
| 	    rootflag = 0; | ||||
| 	    switch(p_sl->flags &~1){ | ||||
| 	    case 0: | ||||
| 	      realloc_symlink(p_stat, p_sl->len); | ||||
| 	      memcpy(&(p_stat->rr.psz_symlink[p_stat->rr.i_symlink]), | ||||
| 		     p_sl->text, p_sl->len); | ||||
| 	      p_stat->rr.i_symlink += p_sl->len; | ||||
| 	      break; | ||||
| 	    case 4: | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.'; | ||||
| 	      /* continue into next case. */ | ||||
| 	    case 2: | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.'; | ||||
| 	      break; | ||||
| 	    case 8: | ||||
| 	      rootflag = 1; | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/'; | ||||
| 	      break; | ||||
| 	    default: | ||||
| 	      cdio_warn("Symlink component flag not implemented"); | ||||
| 	    } | ||||
| 	    slen -= p_sl->len + 2; | ||||
| 	    p_oldsl = p_sl; | ||||
| 	    p_sl = (iso_rock_sl_part_t *) (((char *) p_sl) + p_sl->len + 2); | ||||
| 	     | ||||
| 	    if (slen < 2) { | ||||
| 	      if (((rr->u.SL.flags & 1) != 0) && ((p_oldsl->flags & 1) == 0))  | ||||
| 		p_stat->rr.i_symlink += 1; | ||||
| 	      break; | ||||
| 	    } | ||||
| 	     | ||||
| 	    /*
 | ||||
| 	     * If this component record isn't continued, then append a '/'. | ||||
| 	     */ | ||||
| 	    if (!rootflag && (p_oldsl->flags & 1) == 0) { | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/'; | ||||
| 	    } | ||||
| 	  } | ||||
| 	} | ||||
| 	symlink_len = p_stat->rr.i_symlink; | ||||
| 	realloc_symlink(p_stat, 1); | ||||
| 	p_stat->rr.psz_symlink[symlink_len]='\0'; | ||||
| 	break; | ||||
|       case SIG('R','E'): | ||||
| 	free(buffer); | ||||
| 	return -1; | ||||
|       case SIG('T','F'):  | ||||
| 	/* Time stamp(s) for a file */ | ||||
| 	{ | ||||
| 	  int cnt = 0; | ||||
| 	  add_time(ISO_ROCK_TF_CREATE,     create); | ||||
| 	  add_time(ISO_ROCK_TF_MODIFY,     modify); | ||||
| 	  add_time(ISO_ROCK_TF_ACCESS,     access); | ||||
| 	  add_time(ISO_ROCK_TF_ATTRIBUTES, attributes); | ||||
| 	  add_time(ISO_ROCK_TF_BACKUP,     backup); | ||||
| 	  add_time(ISO_ROCK_TF_EXPIRATION, expiration); | ||||
| 	  add_time(ISO_ROCK_TF_EFFECTIVE,  effective); | ||||
| 	  p_stat->rr.b3_rock = yep; | ||||
| 	  break; | ||||
| 	} | ||||
|       default: | ||||
| 	break; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   free(buffer); | ||||
|   return i_namelen; /* If 0, this file did not have a NM field */ | ||||
|  out: | ||||
|   free(buffer); | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| static int | ||||
| parse_rock_ridge_stat_internal(iso9660_dir_t *p_iso9660_dir, | ||||
| 			       iso9660_stat_t *p_stat, int regard_xa) | ||||
| { | ||||
|   int len; | ||||
|   unsigned char * chr; | ||||
|   int symlink_len = 0; | ||||
|   CONTINUE_DECLS; | ||||
| 
 | ||||
|   if (nope == p_stat->rr.b3_rock) return 0; | ||||
| 
 | ||||
|   SETUP_ROCK_RIDGE(p_iso9660_dir, chr, len); | ||||
|   if (regard_xa) | ||||
|     { | ||||
|       chr+=14; | ||||
|       len-=14; | ||||
|       if (len<0) len=0; | ||||
|     } | ||||
|    | ||||
|   /* repeat:*/ | ||||
|   { | ||||
|     int sig; | ||||
|     iso_extension_record_t * rr; | ||||
|     int rootflag; | ||||
|      | ||||
|     while (len > 1){ /* There may be one byte for padding somewhere */ | ||||
|       rr = (iso_extension_record_t *) chr; | ||||
|       if (rr->len == 0) goto out; /* Something got screwed up here */ | ||||
|       sig = from_721(*chr); | ||||
|       chr += rr->len;  | ||||
|       len -= rr->len; | ||||
|        | ||||
|       switch(sig){ | ||||
|       case SIG('S','P'): | ||||
| 	CHECK_SP(goto out); | ||||
| 	break; | ||||
|       case SIG('C','E'): | ||||
| 	CHECK_CE; | ||||
| 	break; | ||||
|       case SIG('E','R'): | ||||
| 	p_stat->rr.b3_rock = yep; | ||||
| 	cdio_debug("ISO 9660 Extensions: "); | ||||
| 	{ int p; | ||||
| 	  for(p=0;p<rr->u.ER.len_id;p++) cdio_debug("%c",rr->u.ER.data[p]); | ||||
| 	} | ||||
| 	break; | ||||
|       case SIG('P','X'): | ||||
| 	p_stat->rr.st_mode   = from_733(rr->u.PX.st_mode); | ||||
| 	p_stat->rr.st_nlinks = from_733(rr->u.PX.st_nlinks); | ||||
| 	p_stat->rr.st_uid    = from_733(rr->u.PX.st_uid); | ||||
| 	p_stat->rr.st_gid    = from_733(rr->u.PX.st_gid); | ||||
| 	break; | ||||
|       case SIG('P','N'): | ||||
| 	/* Device major,minor number */ | ||||
| 	{ int32_t high, low; | ||||
| 	  high = from_733(rr->u.PN.dev_high); | ||||
| 	  low = from_733(rr->u.PN.dev_low); | ||||
| 	  /*
 | ||||
| 	   * The Rock Ridge standard specifies that if sizeof(dev_t) <= 4, | ||||
| 	   * then the high field is unused, and the device number is completely | ||||
| 	   * stored in the low field.  Some writers may ignore this subtlety, | ||||
| 	   * and as a result we test to see if the entire device number is | ||||
| 	   * stored in the low field, and use that. | ||||
| 	   */ | ||||
| 	  if((low & ~0xff) && high == 0) { | ||||
| 	    p_stat->rr.i_rdev = CDIO_MKDEV(low >> 8, low & 0xff); | ||||
| 	  } else { | ||||
| 	    p_stat->rr.i_rdev = CDIO_MKDEV(high, low); | ||||
| 	  } | ||||
| 	} | ||||
| 	break; | ||||
|       case SIG('T','F'):  | ||||
| 	/* Time stamp(s) for a file */ | ||||
| 	{ | ||||
| 	  int cnt = 0; | ||||
| 	  add_time(ISO_ROCK_TF_CREATE,     create); | ||||
| 	  add_time(ISO_ROCK_TF_MODIFY,     modify); | ||||
| 	  add_time(ISO_ROCK_TF_ACCESS,     access); | ||||
| 	  add_time(ISO_ROCK_TF_ATTRIBUTES, attributes); | ||||
| 	  add_time(ISO_ROCK_TF_BACKUP,     backup); | ||||
| 	  add_time(ISO_ROCK_TF_EXPIRATION, expiration); | ||||
| 	  add_time(ISO_ROCK_TF_EFFECTIVE,  effective); | ||||
| 	  p_stat->rr.b3_rock = yep; | ||||
| 	  break; | ||||
| 	} | ||||
|       case SIG('S','L'): | ||||
| 	{ | ||||
| 	  /* Symbolic link */ | ||||
| 	  uint8_t slen; | ||||
| 	  iso_rock_sl_part_t * p_sl; | ||||
| 	  iso_rock_sl_part_t * p_oldsl; | ||||
| 	  slen = rr->len - 5; | ||||
| 	  p_sl = &rr->u.SL.link; | ||||
| 	  p_stat->rr.i_symlink = symlink_len; | ||||
| 	  while (slen > 1){ | ||||
| 	    rootflag = 0; | ||||
| 	    switch(p_sl->flags &~1){ | ||||
| 	    case 0: | ||||
| 	      realloc_symlink(p_stat, p_sl->len); | ||||
| 	      memcpy(&(p_stat->rr.psz_symlink[p_stat->rr.i_symlink]), | ||||
| 		     p_sl->text, p_sl->len); | ||||
| 	      p_stat->rr.i_symlink += p_sl->len; | ||||
| 	      break; | ||||
| 	    case 4: | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.'; | ||||
| 	      /* continue into next case. */ | ||||
| 	    case 2: | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '.'; | ||||
| 	      break; | ||||
| 	    case 8: | ||||
| 	      rootflag = 1; | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/'; | ||||
| 	      p_stat->rr.i_symlink++; | ||||
| 	      break; | ||||
| 	    default: | ||||
| 	      cdio_warn("Symlink component flag not implemented"); | ||||
| 	    } | ||||
| 	    slen -= p_sl->len + 2; | ||||
| 	    p_oldsl = p_sl; | ||||
| 	    p_sl = (iso_rock_sl_part_t *) (((char *) p_sl) + p_sl->len + 2); | ||||
| 	     | ||||
| 	    if (slen < 2) { | ||||
| 	      if (((rr->u.SL.flags & 1) != 0) && ((p_oldsl->flags & 1) == 0))  | ||||
| 		p_stat->rr.i_symlink += 1; | ||||
| 	      break; | ||||
| 	    } | ||||
| 	     | ||||
| 	    /*
 | ||||
| 	     * If this component record isn't continued, then append a '/'. | ||||
| 	     */ | ||||
| 	    if (!rootflag && (p_oldsl->flags & 1) == 0) { | ||||
| 	      realloc_symlink(p_stat, 1); | ||||
| 	      p_stat->rr.psz_symlink[p_stat->rr.i_symlink++] = '/'; | ||||
| 	    } | ||||
| 	  } | ||||
| 	} | ||||
| 	symlink_len = p_stat->rr.i_symlink; | ||||
| 	realloc_symlink(p_stat, 1); | ||||
| 	p_stat->rr.psz_symlink[symlink_len]='\0'; | ||||
| 	break; | ||||
|       case SIG('R','E'): | ||||
| 	cdio_warn("Attempt to read p_stat for relocated directory"); | ||||
| 	goto out; | ||||
| #ifdef FINISHED | ||||
|       case SIG('C','L'):  | ||||
| 	{ | ||||
| 	  iso9660_stat_t * reloc; | ||||
| 	  ISOFS_I(p_stat)->i_first_extent = from_733(rr->u.CL.location); | ||||
| 	  reloc = isofs_iget(p_stat->rr.i_sb, p_stat->rr.i_first_extent, 0); | ||||
| 	  if (!reloc) | ||||
| 	    goto out; | ||||
| 	  p_stat->rr.st_mode   = reloc->st_mode; | ||||
| 	  p_stat->rr.st_nlinks = reloc->st_nlinks; | ||||
| 	  p_stat->rr.st_uid    = reloc->st_uid; | ||||
| 	  p_stat->rr.st_gid    = reloc->st_gid; | ||||
| 	  p_stat->rr.i_rdev    = reloc->i_rdev; | ||||
| 	  p_stat->rr.i_symlink = reloc->i_symlink; | ||||
| 	  p_stat->rr.i_blocks  = reloc->i_blocks; | ||||
| 	  p_stat->rr.i_atime   = reloc->i_atime; | ||||
| 	  p_stat->rr.i_ctime   = reloc->i_ctime; | ||||
| 	  p_stat->rr.i_mtime   = reloc->i_mtime; | ||||
| 	  iput(reloc); | ||||
| 	} | ||||
| 	break; | ||||
| #endif | ||||
|       default: | ||||
| 	break; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  out: | ||||
|   free(buffer); | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| int  | ||||
| parse_rock_ridge_stat(iso9660_dir_t *p_iso9660_dir,  | ||||
| 		      /*out*/ iso9660_stat_t *p_stat) | ||||
| { | ||||
|   int result; | ||||
| 
 | ||||
|   if (!p_stat) return 0; | ||||
|    | ||||
|   result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 0); | ||||
|   /* if Rock-Ridge flag was reset and we didn't look for attributes
 | ||||
|    * behind eventual XA attributes, have a look there */ | ||||
|   if (0xFF == p_stat->rr.s_rock_offset && nope != p_stat->rr.b3_rock) { | ||||
|     result = parse_rock_ridge_stat_internal(p_iso9660_dir, p_stat, 14); | ||||
|   } | ||||
|   return result; | ||||
| } | ||||
| 
 | ||||
| #define BUF_COUNT 16 | ||||
| #define BUF_SIZE sizeof("drwxrwxrwx") | ||||
| 
 | ||||
| /* Return a pointer to a internal free buffer */ | ||||
| static char * | ||||
| _getbuf (void) | ||||
| { | ||||
|   static char _buf[BUF_COUNT][BUF_SIZE]; | ||||
|   static int _i = -1; | ||||
|    | ||||
|   _i++; | ||||
|   _i %= BUF_COUNT; | ||||
| 
 | ||||
|   memset (_buf[_i], 0, BUF_SIZE); | ||||
| 
 | ||||
|   return _buf[_i]; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns a string which interpreting the POSIX mode st_mode.  | ||||
|   For example: | ||||
|   \verbatim | ||||
|   drwxrws--- | ||||
|   -rw-rw-r-- | ||||
|   lrwxrwxrwx | ||||
|   \endverbatim | ||||
|    | ||||
|   A description of the characters in the string follows | ||||
|   The 1st character is either "b" for a block device,  | ||||
|   "c" for a character device, "d" if the entry is a directory, "l" for | ||||
|   a symbolic link, "p" for a pipe or FIFO, "s" for a "socket",  | ||||
|   or "-" if none of the these. | ||||
|    | ||||
|   The 2nd to 4th characters refer to permissions for a user while the | ||||
|   the 5th to 7th characters refer to permissions for a group while, and  | ||||
|   the 8th to 10h characters refer to permissions for everyone.  | ||||
|    | ||||
|   In each of these triplets the first character (2, 5, 8) is "r" if | ||||
|   the entry is allowed to be read. | ||||
| 
 | ||||
|   The second character of a triplet (3, 6, 9) is "w" if the entry is | ||||
|   allowed to be written. | ||||
| 
 | ||||
|   The third character of a triplet (4, 7, 10) is "x" if the entry is | ||||
|   executable but not user (for character 4) or group (for characters | ||||
|   6) settable and "s" if the item has the corresponding user/group set. | ||||
| 
 | ||||
|   For a directory having an executable property on ("x" or "s") means | ||||
|   the directory is allowed to be listed or "searched". If the execute | ||||
|   property is not allowed for a group or user but the corresponding | ||||
|   group/user is set "S" indicates this. If none of these properties | ||||
|   holds the "-" indicates this. | ||||
| */ | ||||
| const char * | ||||
| iso9660_get_rock_attr_str(posix_mode_t st_mode) | ||||
| { | ||||
|   char *result = _getbuf(); | ||||
| 
 | ||||
|   if (S_ISBLK(st_mode)) | ||||
|     result[ 0] = 'b'; | ||||
|   else if (S_ISDIR(st_mode))  | ||||
|     result[ 0] = 'd'; | ||||
|   else if (S_ISCHR(st_mode)) | ||||
|     result[ 0] = 'c'; | ||||
|   else if (S_ISLNK(st_mode)) | ||||
|     result[ 0] = 'l'; | ||||
|   else if (S_ISFIFO(st_mode)) | ||||
|     result[ 0] = 'p'; | ||||
|   else if (S_ISSOCK(st_mode))  | ||||
|     result[ 0] = 's'; | ||||
|   /* May eventually fill in others.. */ | ||||
|   else  | ||||
|     result[ 0] = '-'; | ||||
| 
 | ||||
|   result[ 1] = (st_mode & ISO_ROCK_IRUSR) ? 'r' : '-'; | ||||
|   result[ 2] = (st_mode & ISO_ROCK_IWUSR) ? 'w' : '-'; | ||||
| 
 | ||||
|   if (st_mode & ISO_ROCK_ISUID)  | ||||
|     result[ 3] = (st_mode & ISO_ROCK_IXUSR) ? 's' : 'S'; | ||||
|   else | ||||
|     result[ 3] = (st_mode & ISO_ROCK_IXUSR) ? 'x' : '-'; | ||||
| 
 | ||||
|   result[ 4] = (st_mode & ISO_ROCK_IRGRP) ? 'r' : '-'; | ||||
|   result[ 5] = (st_mode & ISO_ROCK_IWGRP) ? 'w' : '-'; | ||||
| 
 | ||||
|   if (st_mode & ISO_ROCK_ISGID)  | ||||
|     result[ 6] = (st_mode & ISO_ROCK_IXGRP) ? 's' : 'S'; | ||||
|   else  | ||||
|     result[ 6] = (st_mode & ISO_ROCK_IXGRP) ? 'x' : '-'; | ||||
| 
 | ||||
|   result[ 7] = (st_mode & ISO_ROCK_IROTH) ? 'r' : '-'; | ||||
|   result[ 8] = (st_mode & ISO_ROCK_IWOTH) ? 'w' : '-'; | ||||
|   result[ 9] = (st_mode & ISO_ROCK_IXOTH) ? 'x' : '-'; | ||||
| 
 | ||||
|   result[11] = '\0'; | ||||
| 
 | ||||
|   return result; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns POSIX mode bitstring for a given file. | ||||
| */ | ||||
| mode_t  | ||||
| iso9660_get_posix_filemode_from_rock(const iso_rock_statbuf_t *rr)  | ||||
| { | ||||
|   return (mode_t) rr->st_mode; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
							
								
								
									
										183
									
								
								src/libcdio/iso9660/xa.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										183
									
								
								src/libcdio/iso9660/xa.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,183 @@ | |||
| /*
 | ||||
|   Copyright (C) 2003, 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
|  | ||||
| 
 | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| #include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| #include <sys/stat.h> | ||||
| #endif | ||||
| 
 | ||||
| /*! String inside frame which identifies XA attributes.  Note should
 | ||||
|     come *before* public headers which does a #define of | ||||
|     this name. | ||||
| */ | ||||
| const char ISO_XA_MARKER_STRING[] = {'C', 'D', '-', 'X', 'A', '0', '0', '1'}; | ||||
| 
 | ||||
| /* Public headers */ | ||||
| #include <cdio/iso9660.h> | ||||
| #include <cdio/util.h> | ||||
| #include <cdio/bytesex.h> | ||||
| 
 | ||||
| /* Private headers */ | ||||
| #include "cdio_assert.h" | ||||
| #include "filemode.h" | ||||
| 
 | ||||
| /** The below variable is trickery to force enum symbol values to be
 | ||||
|     recorded in debug symbol tables. It is used to allow one to refer | ||||
|     to the enumeration value names in the typedefs above in a debugger | ||||
|     and debugger expressions. | ||||
| */ | ||||
| xa_misc_enum_t debugger_xa_misc_enum; | ||||
| 
 | ||||
| #define BUF_COUNT 16 | ||||
| #define BUF_SIZE 80 | ||||
| 
 | ||||
| /* Return a pointer to a internal free buffer */ | ||||
| static char * | ||||
| _getbuf (void) | ||||
| { | ||||
|   static char _buf[BUF_COUNT][BUF_SIZE]; | ||||
|   static int _num = -1; | ||||
|    | ||||
|   _num++; | ||||
|   _num %= BUF_COUNT; | ||||
| 
 | ||||
|   memset (_buf[_num], 0, BUF_SIZE); | ||||
| 
 | ||||
|   return _buf[_num]; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns a string which interpreting the extended attribute xa_attr.  | ||||
|   For example: | ||||
|   \verbatim | ||||
|   d---1xrxrxr | ||||
|   ---2--r-r-r | ||||
|   -a--1xrxrxr | ||||
|   \endverbatim | ||||
| 
 | ||||
|   A description of the characters in the string follows | ||||
|   The 1st character is either "d" if the entry is a directory, or "-" if not. | ||||
|   The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not. | ||||
|   The 3rd character is either "i" if the entry is interleaved, or "-" if not. | ||||
|   The 4th character is either "2" if the entry is mode2 form2 or "-" if not. | ||||
|   The 5th character is either "1" if the entry is mode2 form1 or "-" if not. | ||||
|    Note that an entry will either be in mode2 form1 or mode form2. That | ||||
|    is you will either see "2-" or "-1" in the 4th & 5th positions. | ||||
| 
 | ||||
|   The 6th and 7th characters refer to permissions for a user while the | ||||
|   the 8th and 9th characters refer to permissions for a group while, and  | ||||
|   the 10th and 11th characters refer to permissions for a others.  | ||||
|   | ||||
|   In each of these pairs the first character (6, 8, 10) is "x" if the  | ||||
|   entry is executable. For a directory this means the directory is | ||||
|   allowed to be listed or "searched". | ||||
|   The second character of a pair (7, 9, 11) is "r" if the entry is allowed | ||||
|   to be read.  | ||||
| */ | ||||
| 
 | ||||
| const char * | ||||
| iso9660_get_xa_attr_str (uint16_t xa_attr) | ||||
| { | ||||
|   char *result = _getbuf(); | ||||
| 
 | ||||
|   xa_attr = uint16_from_be (xa_attr); | ||||
| 
 | ||||
|   result[ 0] = (xa_attr & XA_ATTR_DIRECTORY) ? 'd' : '-'; | ||||
|   result[ 1] = (xa_attr & XA_ATTR_CDDA) ? 'a' : '-'; | ||||
|   result[ 2] = (xa_attr & XA_ATTR_INTERLEAVED) ? 'i' : '-'; | ||||
|   result[ 3] = (xa_attr & XA_ATTR_MODE2FORM2) ? '2' : '-'; | ||||
|   result[ 4] = (xa_attr & XA_ATTR_MODE2FORM1) ? '1' : '-'; | ||||
| 
 | ||||
|   result[ 5] = (xa_attr & XA_PERM_XUSR) ? 'x' : '-'; | ||||
|   result[ 6] = (xa_attr & XA_PERM_RUSR) ? 'r' : '-'; | ||||
| 
 | ||||
|   result[ 7] = (xa_attr & XA_PERM_XGRP) ? 'x' : '-'; | ||||
|   result[ 8] = (xa_attr & XA_PERM_RGRP) ? 'r' : '-'; | ||||
| 
 | ||||
|   /* Hack alert: wonder if this should be ROTH and XOTH? */ | ||||
|   result[ 9] = (xa_attr & XA_PERM_XSYS) ? 'x' : '-'; | ||||
|   result[10] = (xa_attr & XA_PERM_RSYS) ? 'r' : '-'; | ||||
| 
 | ||||
|   result[11] = '\0'; | ||||
| 
 | ||||
|   return result; | ||||
| } | ||||
| 
 | ||||
| iso9660_xa_t * | ||||
| iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr,  | ||||
| 	      uint8_t filenum) | ||||
| { | ||||
|   cdio_assert (_xa != NULL); | ||||
|    | ||||
|   _xa->user_id = uint16_to_be (uid); | ||||
|   _xa->group_id = uint16_to_be (gid); | ||||
|   _xa->attributes = uint16_to_be (attr); | ||||
| 
 | ||||
|   _xa->signature[0] = 'X'; | ||||
|   _xa->signature[1] = 'A'; | ||||
| 
 | ||||
|   _xa->filenum = filenum; | ||||
| 
 | ||||
|   _xa->reserved[0]  | ||||
|     = _xa->reserved[1]  | ||||
|     = _xa->reserved[2]  | ||||
|     = _xa->reserved[3]  | ||||
|     = _xa->reserved[4] = 0x00; | ||||
| 
 | ||||
|   return _xa; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns POSIX mode bitstring for a given file. | ||||
| */ | ||||
| posix_mode_t  | ||||
| iso9660_get_posix_filemode_from_xa(uint16_t i_perms)  | ||||
| { | ||||
|   posix_mode_t mode = 0; | ||||
|    | ||||
|   if (i_perms & XA_PERM_RUSR)  mode |= S_IRUSR; | ||||
|   if (i_perms & XA_PERM_XUSR)  mode |= S_IXUSR; | ||||
|    | ||||
| #ifdef S_IRGRP | ||||
|   if (i_perms & XA_PERM_RGRP)  mode |= S_IRGRP; | ||||
| #endif | ||||
| #ifdef S_IXGRP | ||||
|   if (i_perms & XA_PERM_XGRP)  mode |= S_IXGRP; | ||||
| #endif | ||||
|    | ||||
| #ifdef S_IROTH | ||||
|   if (i_perms & XA_PERM_ROTH)  mode |= S_IROTH; | ||||
| #endif | ||||
| #ifdef S_IXOTH | ||||
|   if (i_perms & XA_PERM_XOTH)  mode |= S_IXOTH; | ||||
| #endif | ||||
|    | ||||
|   if (i_perms & XA_ATTR_DIRECTORY)  mode |= S_IFDIR; | ||||
|    | ||||
|   return mode; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										176
									
								
								src/libcdio/udf/.msvc/udf.vcxproj
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										176
									
								
								src/libcdio/udf/.msvc/udf.vcxproj
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,176 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\filemode.c" /> | ||||
|     <ClCompile Include="..\udf.c" /> | ||||
|     <ClCompile Include="..\udf_file.c" /> | ||||
|     <ClCompile Include="..\udf_fs.c" /> | ||||
|     <ClCompile Include="..\udf_time.c" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\..\cdio\bytesex.h" /> | ||||
|     <ClInclude Include="..\..\cdio\udf.h" /> | ||||
|     <ClInclude Include="..\..\config.h" /> | ||||
|     <ClInclude Include="..\..\driver\cdio_assert.h" /> | ||||
|     <ClInclude Include="..\..\driver\filemode.h" /> | ||||
|     <ClInclude Include="..\udf_fs.h" /> | ||||
|     <ClInclude Include="..\udf_private.h" /> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}</ProjectGuid> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <RootNamespace>udf</RootNamespace> | ||||
|     <ProjectName>libcdio-udf</ProjectName> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>StaticLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup> | ||||
|     <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86_32\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x86_64\$(Configuration)\$(ProjectName)\</IntDir> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <PrecompiledHeader> | ||||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>HAVE_CONFIG_H;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;..\..\driver;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|     </Link> | ||||
|     <Lib> | ||||
|       <TargetMachine>MachineX64</TargetMachine> | ||||
|     </Lib> | ||||
|   </ItemDefinitionGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										53
									
								
								src/libcdio/udf/.msvc/udf.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/libcdio/udf/.msvc/udf.vcxproj.filters
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="Source Files"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="Header Files"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="..\filemode.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\udf.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\udf_file.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\udf_fs.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="..\udf_time.c"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="..\udf_fs.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\udf_private.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\udf.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\config.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\filemode.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\cdio\bytesex.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="..\..\driver\cdio_assert.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										20
									
								
								src/libcdio/udf/.msvc/udf_sources
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/libcdio/udf/.msvc/udf_sources
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| TARGETNAME=udf | ||||
| TARGETTYPE=LIBRARY | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.;..;..\driver;..\..\msvc-missing | ||||
| LIBCDIO_DEFINES = /DHAVE_CONFIG_H /D_OFF_T_DEFINED /D_off_t=__int64 /Doff_t=_off_t /D_FILE_OFFSET_BITS=64 | ||||
| C_DEFINES=$(C_DEFINES) $(LIBCDIO_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
| MSC_WARNING_LEVEL=/W3 | ||||
| !ENDIF | ||||
| USE_MSVCRT=1 | ||||
| 
 | ||||
| TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ | ||||
|            $(SDK_LIB_PATH)\user32.lib | ||||
| 
 | ||||
| SOURCES=udf.c  \ | ||||
| 	udf_file.c   \ | ||||
| 	udf_fs.c     \ | ||||
| 	udf_time.c   \ | ||||
| 	filemode.c | ||||
							
								
								
									
										4
									
								
								src/libcdio/udf/Makefile.am
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/libcdio/udf/Makefile.am
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| noinst_LIBRARIES = libudf.a | ||||
| libudf_a_SOURCES = udf.c udf_file.c udf_fs.c udf_time.c filemode.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang! | ||||
| libudf_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. -I../driver | ||||
							
								
								
									
										433
									
								
								src/libcdio/udf/Makefile.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										433
									
								
								src/libcdio/udf/Makefile.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,433 @@ | |||
| # Makefile.in generated by automake 1.11.1 from Makefile.am.
 | ||||
| # @configure_input@
 | ||||
| 
 | ||||
| # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 | ||||
| # 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
 | ||||
| # Inc.
 | ||||
| # This Makefile.in is free software; the Free Software Foundation
 | ||||
| # gives unlimited permission to copy and/or distribute it,
 | ||||
| # with or without modifications, as long as this notice is preserved.
 | ||||
| 
 | ||||
| # This program is distributed in the hope that it will be useful,
 | ||||
| # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
 | ||||
| # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 | ||||
| # PARTICULAR PURPOSE.
 | ||||
| 
 | ||||
| @SET_MAKE@ | ||||
| 
 | ||||
| VPATH = @srcdir@ | ||||
| pkgdatadir = $(datadir)/@PACKAGE@ | ||||
| pkgincludedir = $(includedir)/@PACKAGE@ | ||||
| pkglibdir = $(libdir)/@PACKAGE@ | ||||
| pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||||
| am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||||
| install_sh_DATA = $(install_sh) -c -m 644 | ||||
| install_sh_PROGRAM = $(install_sh) -c | ||||
| install_sh_SCRIPT = $(install_sh) -c | ||||
| INSTALL_HEADER = $(INSTALL_DATA) | ||||
| transform = $(program_transform_name) | ||||
| NORMAL_INSTALL = : | ||||
| PRE_INSTALL = : | ||||
| POST_INSTALL = : | ||||
| NORMAL_UNINSTALL = : | ||||
| PRE_UNINSTALL = : | ||||
| POST_UNINSTALL = : | ||||
| subdir = src/libcdio/udf | ||||
| DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am | ||||
| ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||||
| am__aclocal_m4_deps = $(top_srcdir)/configure.ac | ||||
| am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 | ||||
| 	$(ACLOCAL_M4) | ||||
| mkinstalldirs = $(install_sh) -d | ||||
| CONFIG_CLEAN_FILES = | ||||
| CONFIG_CLEAN_VPATH_FILES = | ||||
| LIBRARIES = $(noinst_LIBRARIES) | ||||
| AR = ar | ||||
| ARFLAGS = cru | ||||
| AM_V_AR = $(am__v_AR_$(V)) | ||||
| am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_AR_0 = @echo "  AR    " $@; | ||||
| AM_V_at = $(am__v_at_$(V)) | ||||
| am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_at_0 = @ | ||||
| libudf_a_AR = $(AR) $(ARFLAGS) | ||||
| libudf_a_LIBADD = | ||||
| am_libudf_a_OBJECTS = libudf_a-udf.$(OBJEXT) \
 | ||||
| 	libudf_a-udf_file.$(OBJEXT) libudf_a-udf_fs.$(OBJEXT) \
 | ||||
| 	libudf_a-udf_time.$(OBJEXT) libudf_a-filemode.$(OBJEXT) | ||||
| libudf_a_OBJECTS = $(am_libudf_a_OBJECTS) | ||||
| DEFAULT_INCLUDES = -I.@am__isrc@ | ||||
| depcomp = | ||||
| am__depfiles_maybe = | ||||
| AM_V_lt = $(am__v_lt_$(V)) | ||||
| am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_lt_0 = --silent | ||||
| COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 | ||||
| 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||||
| AM_V_CC = $(am__v_CC_$(V)) | ||||
| am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CC_0 = @echo "  CC    " $@; | ||||
| CCLD = $(CC) | ||||
| LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||||
| AM_V_CCLD = $(am__v_CCLD_$(V)) | ||||
| am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_CCLD_0 = @echo "  CCLD  " $@; | ||||
| AM_V_GEN = $(am__v_GEN_$(V)) | ||||
| am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||||
| am__v_GEN_0 = @echo "  GEN   " $@; | ||||
| SOURCES = $(libudf_a_SOURCES) | ||||
| ETAGS = etags | ||||
| CTAGS = ctags | ||||
| ACLOCAL = @ACLOCAL@ | ||||
| AMTAR = @AMTAR@ | ||||
| AM_CFLAGS = @AM_CFLAGS@ | ||||
| AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||||
| AM_LDFLAGS = @AM_LDFLAGS@ | ||||
| AM_RCFLAGS = @AM_RCFLAGS@ | ||||
| AUTOCONF = @AUTOCONF@ | ||||
| AUTOHEADER = @AUTOHEADER@ | ||||
| AUTOMAKE = @AUTOMAKE@ | ||||
| AWK = @AWK@ | ||||
| CC = @CC@ | ||||
| CFLAGS = @CFLAGS@ | ||||
| CPPFLAGS = @CPPFLAGS@ | ||||
| CYGPATH_W = @CYGPATH_W@ | ||||
| DEFS = @DEFS@ | ||||
| ECHO_C = @ECHO_C@ | ||||
| ECHO_N = @ECHO_N@ | ||||
| ECHO_T = @ECHO_T@ | ||||
| EXEEXT = @EXEEXT@ | ||||
| EXESUFFIX = @EXESUFFIX@ | ||||
| INSTALL = @INSTALL@ | ||||
| INSTALL_DATA = @INSTALL_DATA@ | ||||
| INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||||
| INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||||
| INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||||
| LDFLAGS = @LDFLAGS@ | ||||
| LIBOBJS = @LIBOBJS@ | ||||
| LIBS = @LIBS@ | ||||
| LTLIBOBJS = @LTLIBOBJS@ | ||||
| MAKEINFO = @MAKEINFO@ | ||||
| MKDIR_P = @MKDIR_P@ | ||||
| OBJEXT = @OBJEXT@ | ||||
| PACKAGE = @PACKAGE@ | ||||
| PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||||
| PACKAGE_NAME = @PACKAGE_NAME@ | ||||
| PACKAGE_STRING = @PACKAGE_STRING@ | ||||
| PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||||
| PACKAGE_URL = @PACKAGE_URL@ | ||||
| PACKAGE_VERSION = @PACKAGE_VERSION@ | ||||
| PATH_SEPARATOR = @PATH_SEPARATOR@ | ||||
| RANLIB = @RANLIB@ | ||||
| RM = @RM@ | ||||
| SET_MAKE = @SET_MAKE@ | ||||
| SHELL = @SHELL@ | ||||
| STRIP = @STRIP@ | ||||
| VERSION = @VERSION@ | ||||
| VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@ | ||||
| WINDRES = @WINDRES@ | ||||
| abs_builddir = @abs_builddir@ | ||||
| abs_srcdir = @abs_srcdir@ | ||||
| abs_top_builddir = @abs_top_builddir@ | ||||
| abs_top_srcdir = @abs_top_srcdir@ | ||||
| ac_ct_CC = @ac_ct_CC@ | ||||
| am__leading_dot = @am__leading_dot@ | ||||
| am__tar = @am__tar@ | ||||
| am__untar = @am__untar@ | ||||
| bindir = @bindir@ | ||||
| build_alias = @build_alias@ | ||||
| builddir = @builddir@ | ||||
| datadir = @datadir@ | ||||
| datarootdir = @datarootdir@ | ||||
| docdir = @docdir@ | ||||
| dvidir = @dvidir@ | ||||
| exec_prefix = @exec_prefix@ | ||||
| host_alias = @host_alias@ | ||||
| htmldir = @htmldir@ | ||||
| includedir = @includedir@ | ||||
| infodir = @infodir@ | ||||
| install_sh = @install_sh@ | ||||
| libdir = @libdir@ | ||||
| libexecdir = @libexecdir@ | ||||
| localedir = @localedir@ | ||||
| localstatedir = @localstatedir@ | ||||
| mandir = @mandir@ | ||||
| mkdir_p = @mkdir_p@ | ||||
| oldincludedir = @oldincludedir@ | ||||
| pdfdir = @pdfdir@ | ||||
| prefix = @prefix@ | ||||
| program_transform_name = @program_transform_name@ | ||||
| psdir = @psdir@ | ||||
| sbindir = @sbindir@ | ||||
| sharedstatedir = @sharedstatedir@ | ||||
| srcdir = @srcdir@ | ||||
| sysconfdir = @sysconfdir@ | ||||
| target_alias = @target_alias@ | ||||
| top_build_prefix = @top_build_prefix@ | ||||
| top_builddir = @top_builddir@ | ||||
| top_srcdir = @top_srcdir@ | ||||
| noinst_LIBRARIES = libudf.a | ||||
| libudf_a_SOURCES = udf.c udf_file.c udf_fs.c udf_time.c filemode.c | ||||
| # Boy do you NOT want to have HAVE_CONFIG_H set before $(AM_CFLAGS) with Clang!
 | ||||
| libudf_a_CFLAGS = $(AM_CFLAGS) -DHAVE_CONFIG_H -I. -I.. -I../driver | ||||
| all: all-am | ||||
| 
 | ||||
| .SUFFIXES: | ||||
| .SUFFIXES: .c .o .obj | ||||
| $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps) | ||||
| 	@for dep in $?; do \
 | ||||
| 	  case '$(am__configure_deps)' in \
 | ||||
| 	    *$$dep*) \
 | ||||
| 	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
 | ||||
| 	        && { if test -f $@; then exit 0; else break; fi; }; \
 | ||||
| 	      exit 1;; \
 | ||||
| 	  esac; \
 | ||||
| 	done; \
 | ||||
| 	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/libcdio/udf/Makefile'; \
 | ||||
| 	$(am__cd) $(top_srcdir) && \
 | ||||
| 	  $(AUTOMAKE) --foreign --ignore-deps src/libcdio/udf/Makefile | ||||
| .PRECIOUS: Makefile | ||||
| Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||||
| 	@case '$?' in \
 | ||||
| 	  *config.status*) \
 | ||||
| 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 | ||||
| 	  *) \
 | ||||
| 	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
 | ||||
| 	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
 | ||||
| 	esac; | ||||
| 
 | ||||
| $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| 
 | ||||
| $(top_srcdir)/configure:  $(am__configure_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(ACLOCAL_M4):  $(am__aclocal_m4_deps) | ||||
| 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||||
| $(am__aclocal_m4_deps): | ||||
| 
 | ||||
| clean-noinstLIBRARIES: | ||||
| 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) | ||||
| libudf.a: $(libudf_a_OBJECTS) $(libudf_a_DEPENDENCIES)  | ||||
| 	$(AM_V_at)-rm -f libudf.a | ||||
| 	$(AM_V_AR)$(libudf_a_AR) libudf.a $(libudf_a_OBJECTS) $(libudf_a_LIBADD) | ||||
| 	$(AM_V_at)$(RANLIB) libudf.a | ||||
| 
 | ||||
| mostlyclean-compile: | ||||
| 	-rm -f *.$(OBJEXT) | ||||
| 
 | ||||
| distclean-compile: | ||||
| 	-rm -f *.tab.c | ||||
| 
 | ||||
| .c.o: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c $< | ||||
| 
 | ||||
| .c.obj: | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(COMPILE) -c `$(CYGPATH_W) '$<'` | ||||
| 
 | ||||
| libudf_a-udf.o: udf.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf.o `test -f 'udf.c' || echo '$(srcdir)/'`udf.c | ||||
| 
 | ||||
| libudf_a-udf.obj: udf.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf.obj `if test -f 'udf.c'; then $(CYGPATH_W) 'udf.c'; else $(CYGPATH_W) '$(srcdir)/udf.c'; fi` | ||||
| 
 | ||||
| libudf_a-udf_file.o: udf_file.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_file.o `test -f 'udf_file.c' || echo '$(srcdir)/'`udf_file.c | ||||
| 
 | ||||
| libudf_a-udf_file.obj: udf_file.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_file.obj `if test -f 'udf_file.c'; then $(CYGPATH_W) 'udf_file.c'; else $(CYGPATH_W) '$(srcdir)/udf_file.c'; fi` | ||||
| 
 | ||||
| libudf_a-udf_fs.o: udf_fs.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_fs.o `test -f 'udf_fs.c' || echo '$(srcdir)/'`udf_fs.c | ||||
| 
 | ||||
| libudf_a-udf_fs.obj: udf_fs.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_fs.obj `if test -f 'udf_fs.c'; then $(CYGPATH_W) 'udf_fs.c'; else $(CYGPATH_W) '$(srcdir)/udf_fs.c'; fi` | ||||
| 
 | ||||
| libudf_a-udf_time.o: udf_time.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_time.o `test -f 'udf_time.c' || echo '$(srcdir)/'`udf_time.c | ||||
| 
 | ||||
| libudf_a-udf_time.obj: udf_time.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-udf_time.obj `if test -f 'udf_time.c'; then $(CYGPATH_W) 'udf_time.c'; else $(CYGPATH_W) '$(srcdir)/udf_time.c'; fi` | ||||
| 
 | ||||
| libudf_a-filemode.o: filemode.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-filemode.o `test -f 'filemode.c' || echo '$(srcdir)/'`filemode.c | ||||
| 
 | ||||
| libudf_a-filemode.obj: filemode.c | ||||
| 	$(AM_V_CC) @AM_BACKSLASH@ | ||||
| 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libudf_a_CFLAGS) $(CFLAGS) -c -o libudf_a-filemode.obj `if test -f 'filemode.c'; then $(CYGPATH_W) 'filemode.c'; else $(CYGPATH_W) '$(srcdir)/filemode.c'; fi` | ||||
| 
 | ||||
| ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||||
| 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	mkid -fID $$unique | ||||
| tags: TAGS | ||||
| 
 | ||||
| TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	set x; \
 | ||||
| 	here=`pwd`; \
 | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	shift; \
 | ||||
| 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 | ||||
| 	  test -n "$$unique" || unique=$$empty_fix; \
 | ||||
| 	  if test $$# -gt 0; then \ | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      "$$@" $$unique; \
 | ||||
| 	  else \
 | ||||
| 	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | ||||
| 	      $$unique; \
 | ||||
| 	  fi; \
 | ||||
| 	fi | ||||
| ctags: CTAGS | ||||
| CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \ | ||||
| 		$(TAGS_FILES) $(LISP) | ||||
| 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | ||||
| 	unique=`for i in $$list; do \
 | ||||
| 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | ||||
| 	  done | \
 | ||||
| 	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | ||||
| 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | ||||
| 	test -z "$(CTAGS_ARGS)$$unique" \
 | ||||
| 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 | ||||
| 	     $$unique | ||||
| 
 | ||||
| GTAGS: | ||||
| 	here=`$(am__cd) $(top_builddir) && pwd` \
 | ||||
| 	  && $(am__cd) $(top_srcdir) \
 | ||||
| 	  && gtags -i $(GTAGS_ARGS) "$$here" | ||||
| 
 | ||||
| distclean-tags: | ||||
| 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||||
| check-am: all-am | ||||
| check: check-am | ||||
| all-am: Makefile $(LIBRARIES) | ||||
| installdirs: | ||||
| install: install-am | ||||
| install-exec: install-exec-am | ||||
| install-data: install-data-am | ||||
| uninstall: uninstall-am | ||||
| 
 | ||||
| install-am: all-am | ||||
| 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||||
| 
 | ||||
| installcheck: installcheck-am | ||||
| install-strip: | ||||
| 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
 | ||||
| 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
 | ||||
| 	  `test -z '$(STRIP)' || \
 | ||||
| 	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||||
| mostlyclean-generic: | ||||
| 
 | ||||
| clean-generic: | ||||
| 
 | ||||
| distclean-generic: | ||||
| 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||||
| 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||||
| 
 | ||||
| maintainer-clean-generic: | ||||
| 	@echo "This command is intended for maintainers to use" | ||||
| 	@echo "it deletes files that may require special tools to rebuild." | ||||
| clean: clean-am | ||||
| 
 | ||||
| clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am | ||||
| 
 | ||||
| distclean: distclean-am | ||||
| 	-rm -f Makefile | ||||
| distclean-am: clean-am distclean-compile distclean-generic \ | ||||
| 	distclean-tags | ||||
| 
 | ||||
| dvi: dvi-am | ||||
| 
 | ||||
| dvi-am: | ||||
| 
 | ||||
| html: html-am | ||||
| 
 | ||||
| html-am: | ||||
| 
 | ||||
| info: info-am | ||||
| 
 | ||||
| info-am: | ||||
| 
 | ||||
| install-data-am: | ||||
| 
 | ||||
| install-dvi: install-dvi-am | ||||
| 
 | ||||
| install-dvi-am: | ||||
| 
 | ||||
| install-exec-am: | ||||
| 
 | ||||
| install-html: install-html-am | ||||
| 
 | ||||
| install-html-am: | ||||
| 
 | ||||
| install-info: install-info-am | ||||
| 
 | ||||
| install-info-am: | ||||
| 
 | ||||
| install-man: | ||||
| 
 | ||||
| install-pdf: install-pdf-am | ||||
| 
 | ||||
| install-pdf-am: | ||||
| 
 | ||||
| install-ps: install-ps-am | ||||
| 
 | ||||
| install-ps-am: | ||||
| 
 | ||||
| installcheck-am: | ||||
| 
 | ||||
| maintainer-clean: maintainer-clean-am | ||||
| 	-rm -f Makefile | ||||
| maintainer-clean-am: distclean-am maintainer-clean-generic | ||||
| 
 | ||||
| mostlyclean: mostlyclean-am | ||||
| 
 | ||||
| mostlyclean-am: mostlyclean-compile mostlyclean-generic | ||||
| 
 | ||||
| pdf: pdf-am | ||||
| 
 | ||||
| pdf-am: | ||||
| 
 | ||||
| ps: ps-am | ||||
| 
 | ||||
| ps-am: | ||||
| 
 | ||||
| uninstall-am: | ||||
| 
 | ||||
| .MAKE: install-am install-strip | ||||
| 
 | ||||
| .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||||
| 	clean-noinstLIBRARIES ctags distclean distclean-compile \
 | ||||
| 	distclean-generic distclean-tags dvi dvi-am html html-am info \
 | ||||
| 	info-am install install-am install-data install-data-am \
 | ||||
| 	install-dvi install-dvi-am install-exec install-exec-am \
 | ||||
| 	install-html install-html-am install-info install-info-am \
 | ||||
| 	install-man install-pdf install-pdf-am install-ps \
 | ||||
| 	install-ps-am install-strip installcheck installcheck-am \
 | ||||
| 	installdirs maintainer-clean maintainer-clean-generic \
 | ||||
| 	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
 | ||||
| 	ps ps-am tags uninstall uninstall-am | ||||
| 
 | ||||
| 
 | ||||
| # Tell versions [3.59,3.63) of GNU make to not export all variables.
 | ||||
| # Otherwise a system limit (for SysV at least) may be exceeded.
 | ||||
| .NOEXPORT: | ||||
							
								
								
									
										200
									
								
								src/libcdio/udf/filemode.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								src/libcdio/udf/filemode.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,200 @@ | |||
| /*
 | ||||
|   filemode.c -- make a string describing file modes | ||||
| 
 | ||||
|   Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc. | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| #if HAVE_CONFIG_H | ||||
| # include <config.h> | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| #include <sys/stat.h> | ||||
| #endif  | ||||
| 
 | ||||
| #include <cdio/udf.h> | ||||
| #include "filemode.h" | ||||
| 
 | ||||
| 
 | ||||
| /* Set the 's' and 't' flags in file attributes string CHARS,
 | ||||
|    according to the file mode BITS.  */ | ||||
| 
 | ||||
| static void | ||||
| setst (mode_t bits, char *chars) | ||||
| { | ||||
| #ifdef S_ISUID | ||||
|   if (bits & S_ISUID) | ||||
|     { | ||||
|       if (chars[3] != 'x') | ||||
| 	/* Set-uid, but not executable by owner.  */ | ||||
| 	chars[3] = 'S'; | ||||
|       else | ||||
| 	chars[3] = 's'; | ||||
|     } | ||||
| #endif | ||||
| #ifdef S_ISGID | ||||
|   if (bits & S_ISGID) | ||||
|     { | ||||
|       if (chars[6] != 'x') | ||||
| 	/* Set-gid, but not executable by group.  */ | ||||
| 	chars[6] = 'S'; | ||||
|       else | ||||
| 	chars[6] = 's'; | ||||
|     } | ||||
| #endif | ||||
| #ifdef S_ISVTX | ||||
|   if (bits & S_ISVTX) | ||||
|     { | ||||
|       if (chars[9] != 'x') | ||||
| 	/* Sticky, but not executable by others.  */ | ||||
| 	chars[9] = 'T'; | ||||
|       else | ||||
| 	chars[9] = 't'; | ||||
|     } | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| /* Return a character indicating the type of file described by
 | ||||
|    file mode BITS: | ||||
|    'd' for directories | ||||
|    'D' for doors | ||||
|    'b' for block special files | ||||
|    'c' for character special files | ||||
|    'n' for network special files | ||||
|    'm' for multiplexor files | ||||
|    'M' for an off-line (regular) file | ||||
|    'l' for symbolic links | ||||
|    's' for sockets | ||||
|    'p' for fifos | ||||
|    'C' for contigous data files | ||||
|    '-' for regular files | ||||
|    '?' for any other file type.  */ | ||||
| 
 | ||||
| static char | ||||
| ftypelet (mode_t bits) | ||||
| { | ||||
| #ifdef S_ISBLK | ||||
|   if (S_ISBLK (bits)) | ||||
|     return 'b'; | ||||
| #endif | ||||
|   if (S_ISCHR (bits)) | ||||
|     return 'c'; | ||||
|   if (S_ISDIR (bits)) | ||||
|     return 'd'; | ||||
|   if (S_ISREG (bits)) | ||||
|     return '-'; | ||||
| #ifdef S_ISFIFO | ||||
|   if (S_ISFIFO (bits)) | ||||
|     return 'p'; | ||||
| #endif | ||||
| #ifdef S_ISLNK | ||||
|   if (S_ISLNK (bits)) | ||||
|     return 'l'; | ||||
| #endif | ||||
| #ifdef S_ISSOCK | ||||
|   if (S_ISSOCK (bits)) | ||||
|     return 's'; | ||||
| #endif | ||||
| #ifdef S_ISMPC | ||||
|   if (S_ISMPC (bits)) | ||||
|     return 'm'; | ||||
| #endif | ||||
| #ifdef S_ISNWK | ||||
|   if (S_ISNWK (bits)) | ||||
|     return 'n'; | ||||
| #endif | ||||
| #ifdef S_ISDOOR | ||||
|   if (S_ISDOOR (bits)) | ||||
|     return 'D'; | ||||
| #endif | ||||
| #ifdef S_ISCTG | ||||
|   if (S_ISCTG (bits)) | ||||
|     return 'C'; | ||||
| #endif | ||||
| 
 | ||||
|   /* The following two tests are for Cray DMF (Data Migration
 | ||||
|      Facility), which is a HSM file system.  A migrated file has a | ||||
|      `st_dm_mode' that is different from the normal `st_mode', so any | ||||
|      tests for migrated files should use the former.  */ | ||||
| 
 | ||||
| #ifdef S_ISOFD | ||||
|   if (S_ISOFD (bits)) | ||||
|     /* off line, with data  */ | ||||
|     return 'M'; | ||||
| #endif | ||||
| #ifdef S_ISOFL | ||||
|   /* off line, with no data  */ | ||||
|   if (S_ISOFL (bits)) | ||||
|     return 'M'; | ||||
| #endif | ||||
|   return '?'; | ||||
| } | ||||
| 
 | ||||
| /*! udf_mode_string - fill in string STR with an ls-style ASCII
 | ||||
|    representation of the st_mode field of file stats block STATP. | ||||
|    10 characters are stored in STR; no terminating null is added. | ||||
|    The characters stored in STR are: | ||||
| 
 | ||||
|    0	File type.  'd' for directory, 'c' for character | ||||
| 	special, 'b' for block special, 'm' for multiplex, | ||||
| 	'l' for symbolic link, 's' for socket, 'p' for fifo, | ||||
| 	'-' for regular, '?' for any other file type | ||||
| 
 | ||||
|    1	'r' if the owner may read, '-' otherwise. | ||||
| 
 | ||||
|    2	'w' if the owner may write, '-' otherwise. | ||||
| 
 | ||||
|    3	'x' if the owner may execute, 's' if the file is | ||||
| 	set-user-id, '-' otherwise. | ||||
| 	'S' if the file is set-user-id, but the execute | ||||
| 	bit isn't set. | ||||
| 
 | ||||
|    4	'r' if group members may read, '-' otherwise. | ||||
| 
 | ||||
|    5	'w' if group members may write, '-' otherwise. | ||||
| 
 | ||||
|    6	'x' if group members may execute, 's' if the file is | ||||
| 	set-group-id, '-' otherwise. | ||||
| 	'S' if it is set-group-id but not executable. | ||||
| 
 | ||||
|    7	'r' if any user may read, '-' otherwise. | ||||
| 
 | ||||
|    8	'w' if any user may write, '-' otherwise. | ||||
| 
 | ||||
|    9	'x' if any user may execute, 't' if the file is "sticky" | ||||
| 	(will be retained in swap space after execution), '-' | ||||
| 	otherwise. | ||||
| 	'T' if the file is sticky but not executable.  */ | ||||
| 
 | ||||
| char * | ||||
| udf_mode_string (mode_t i_mode, char *psz_str) | ||||
| { | ||||
|   psz_str[ 0] = ftypelet (i_mode); | ||||
|   psz_str[ 1] = i_mode & S_IRUSR ? 'r' : '-'; | ||||
|   psz_str[ 2] = i_mode & S_IWUSR ? 'w' : '-'; | ||||
|   psz_str[ 3] = i_mode & S_IXUSR ? 'x' : '-'; | ||||
|   psz_str[ 4] = i_mode & S_IRGRP ? 'r' : '-'; | ||||
|   psz_str[ 5] = i_mode & S_IWGRP ? 'w' : '-'; | ||||
|   psz_str[ 6] = i_mode & S_IXGRP ? 'x' : '-'; | ||||
|   psz_str[ 7] = i_mode & S_IROTH ? 'r' : '-'; | ||||
|   psz_str[ 8] = i_mode & S_IWOTH ? 'w' : '-'; | ||||
|   psz_str[ 9] = i_mode & S_IXOTH ? 'x' : '-'; | ||||
|   psz_str[10] = '\0'; | ||||
|   setst (i_mode, psz_str); | ||||
|   return psz_str; | ||||
| } | ||||
							
								
								
									
										127
									
								
								src/libcdio/udf/udf.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								src/libcdio/udf/udf.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,127 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2008, 2010 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /* Access routines */ | ||||
| 
 | ||||
| /* udf_private.h has to come first else _FILE_OFFSET_BITS are redefined in
 | ||||
|    say opensolaris. */ | ||||
| #include "udf_private.h" | ||||
| #include <cdio/bytesex.h> | ||||
| #include "filemode.h" | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| # include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_SYS_STAT_H | ||||
| # include <sys/stat.h> | ||||
| #endif | ||||
| 
 | ||||
| /** The below variables are trickery to force enum symbol values to be
 | ||||
|     recorded in debug symbol tables. They are used to allow one to refer | ||||
|     to the enumeration value names in the typedefs above in a debugger | ||||
|     and debugger expressions | ||||
| */ | ||||
| tag_id_t                 debug_tagid; | ||||
| file_characteristics_t   debug_file_characteristics; | ||||
| icbtag_file_type_enum_t  debug_icbtag_file_type_enum; | ||||
| icbtag_flag_enum_t       debug_flag_enum; | ||||
| ecma_167_enum1_t         debug_ecma_167_enum1; | ||||
| ecma_167_timezone_enum_t debug_ecma_167_timezone_enum; | ||||
| udf_enum1_t              debug_udf_enum1; | ||||
|    | ||||
| 
 | ||||
| /*!
 | ||||
|   Returns POSIX mode bitstring for a given file. | ||||
| */ | ||||
| mode_t  | ||||
| udf_get_posix_filemode(const udf_dirent_t *p_udf_dirent)  | ||||
| { | ||||
|   udf_file_entry_t udf_fe; | ||||
|   mode_t mode = 0; | ||||
| 
 | ||||
|   if (udf_get_file_entry(p_udf_dirent, &udf_fe)) { | ||||
|     uint32_t i_perms; | ||||
| #ifdef S_ISUID | ||||
|     uint16_t i_flags; | ||||
| 
 | ||||
|     i_flags = uint16_from_le(udf_fe.icb_tag.flags); | ||||
| #endif | ||||
|     i_perms = uint32_from_le(udf_fe.permissions); | ||||
| 
 | ||||
|     if (i_perms & FE_PERM_U_READ)  mode |= S_IRUSR; | ||||
|     if (i_perms & FE_PERM_U_WRITE) mode |= S_IWUSR; | ||||
|     if (i_perms & FE_PERM_U_EXEC)  mode |= S_IXUSR; | ||||
|      | ||||
| #ifdef S_IRGRP | ||||
|     if (i_perms & FE_PERM_G_READ)  mode |= S_IRGRP; | ||||
|     if (i_perms & FE_PERM_G_WRITE) mode |= S_IWGRP; | ||||
|     if (i_perms & FE_PERM_G_EXEC)  mode |= S_IXGRP; | ||||
| #endif | ||||
|      | ||||
| #ifdef S_IROTH | ||||
|     if (i_perms & FE_PERM_O_READ)  mode |= S_IROTH; | ||||
|     if (i_perms & FE_PERM_O_WRITE) mode |= S_IWOTH; | ||||
|     if (i_perms & FE_PERM_O_EXEC)  mode |= S_IXOTH; | ||||
| #endif | ||||
| 
 | ||||
|     switch (udf_fe.icb_tag.file_type) { | ||||
|     case ICBTAG_FILE_TYPE_DIRECTORY:  | ||||
|       mode |= S_IFDIR; | ||||
|       break; | ||||
|     case ICBTAG_FILE_TYPE_REGULAR: | ||||
|       mode |= S_IFREG; | ||||
|       break; | ||||
| #ifdef S_IFLNK | ||||
|     case ICBTAG_FILE_TYPE_SYMLINK: | ||||
|       mode |= S_IFLNK; | ||||
|       break; | ||||
| #endif | ||||
|     case ICBTAG_FILE_TYPE_CHAR: | ||||
|       mode |= S_IFCHR; | ||||
|       break; | ||||
| #ifdef S_IFSOCK | ||||
|     case ICBTAG_FILE_TYPE_SOCKET: | ||||
|       mode |= S_IFSOCK; | ||||
|       break; | ||||
| #endif | ||||
|     case ICBTAG_FILE_TYPE_BLOCK: | ||||
|       mode |= S_IFBLK; | ||||
|       break; | ||||
|     default: ; | ||||
|     }; | ||||
|    | ||||
| #ifdef S_ISUID | ||||
|     if (i_flags & ICBTAG_FLAG_SETUID) mode |= S_ISUID; | ||||
|     if (i_flags & ICBTAG_FLAG_SETGID) mode |= S_ISGID; | ||||
|     if (i_flags & ICBTAG_FLAG_STICKY) mode |= S_ISVTX; | ||||
| #endif | ||||
|   } | ||||
|    | ||||
|   return mode; | ||||
|    | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the partition number of the the opened udf handle. -1  | ||||
|   Is returned if we have an error. | ||||
| */ | ||||
| int16_t udf_get_part_number(const udf_t *p_udf) | ||||
| { | ||||
|   if (!p_udf) return -1; | ||||
|   return p_udf->i_partition; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										267
									
								
								src/libcdio/udf/udf_file.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										267
									
								
								src/libcdio/udf/udf_file.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,267 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2006, 2008, 2010 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /* Access routines */ | ||||
| 
 | ||||
| /* udf_private.h has to come first else _FILE_OFFSET_BITS are redefined in
 | ||||
|    say opensolaris. */ | ||||
| #include "udf_private.h" | ||||
| #include <cdio/bytesex.h> | ||||
| #include "udf_fs.h" | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| # include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h>  /* Remove when adding cdio/logging.h */ | ||||
| #endif | ||||
| 
 | ||||
| /* Useful defines */ | ||||
| 
 | ||||
| #define MIN(a, b) (a<b) ? (a) : (b) | ||||
| #define CEILING(x, y) ((x+(y-1))/y) | ||||
| 
 | ||||
| #define	GETICB(offset)	\ | ||||
| 	&p_udf_fe->u.alloc_descs[offset] | ||||
| 
 | ||||
| const char * | ||||
| udf_get_filename(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   if (!p_udf_dirent) return NULL; | ||||
|   if (!p_udf_dirent->psz_name) return ".."; | ||||
|   return p_udf_dirent->psz_name; | ||||
| } | ||||
| 
 | ||||
| /* Copy an UDF File Entry into a Directory Entry structure. */ | ||||
| bool | ||||
| udf_get_file_entry(const udf_dirent_t *p_udf_dirent,  | ||||
| 		   /*out*/ udf_file_entry_t *p_udf_fe) | ||||
| { | ||||
|   if (!p_udf_dirent) return false; | ||||
|   memcpy(p_udf_fe, &p_udf_dirent->fe, sizeof(udf_file_entry_t)); | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the file id descriptor of the given file. | ||||
| */ | ||||
| bool udf_get_fileid_descriptor(const udf_dirent_t *p_udf_dirent,  | ||||
| 			       /*out*/ udf_fileid_desc_t *p_udf_fid) | ||||
| { | ||||
|    | ||||
|   if (!p_udf_dirent) return false; | ||||
|   if (!p_udf_dirent->fid) { | ||||
|     /* FIXME do something about trying to get the descriptor. */ | ||||
|     return false; | ||||
|   } | ||||
|   memcpy(p_udf_fid, p_udf_dirent->fid, sizeof(udf_fileid_desc_t)); | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the number of hard links of the file. Return 0 if error. | ||||
| */ | ||||
| uint16_t udf_get_link_count(const udf_dirent_t *p_udf_dirent)  | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     return uint16_from_le(p_udf_dirent->fe.link_count); | ||||
|   } | ||||
|   return 0; /* Error. Non-error case handled above. */ | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the file length the file. Return 2147483647L if error. | ||||
| */ | ||||
| uint64_t udf_get_file_length(const udf_dirent_t *p_udf_dirent)  | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     return uint64_from_le(p_udf_dirent->fe.info_len); | ||||
|   } | ||||
|   return 2147483647L; /* Error. Non-error case handled above. */ | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return true if the file is a directory. | ||||
| */ | ||||
| bool | ||||
| udf_is_dir(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   return p_udf_dirent->b_dir; | ||||
| } | ||||
| 
 | ||||
| /*
 | ||||
|  * Translate a file offset into a logical block and then into a physical | ||||
|  * block. | ||||
|  */ | ||||
| static lba_t | ||||
| offset_to_lba(const udf_dirent_t *p_udf_dirent, off_t i_offset,  | ||||
| 	      /*out*/ lba_t *pi_lba, /*out*/ uint32_t *pi_max_size) | ||||
| { | ||||
|   udf_t *p_udf = p_udf_dirent->p_udf; | ||||
|   const udf_file_entry_t *p_udf_fe = (udf_file_entry_t *)  | ||||
|     &p_udf_dirent->fe; | ||||
|   const udf_icbtag_t *p_icb_tag = &p_udf_fe->icb_tag; | ||||
|   const uint16_t strat_type= uint16_from_le(p_icb_tag->strat_type); | ||||
| 
 | ||||
|   if (i_offset < 0) { | ||||
|     cdio_warn("Negative offset value"); | ||||
|     return CDIO_INVALID_LBA; | ||||
|   } | ||||
| 
 | ||||
|   switch (strat_type) { | ||||
|   case 4096: | ||||
|     cdio_warn("Cannot deal with strategy4096 yet!"); | ||||
|     return CDIO_INVALID_LBA; | ||||
|     break; | ||||
|   case ICBTAG_STRATEGY_TYPE_4: | ||||
|     { | ||||
|       off_t icblen = 0; | ||||
|       uint64_t lsector; | ||||
|       int ad_offset, ad_num = 0; | ||||
|       uint16_t addr_ilk = uint16_from_le(p_icb_tag->flags&ICBTAG_FLAG_AD_MASK); | ||||
|        | ||||
|       switch (addr_ilk) { | ||||
|       case ICBTAG_FLAG_AD_SHORT:  | ||||
| 	{ | ||||
| 	  udf_short_ad_t *p_icb; | ||||
| 	  /*
 | ||||
| 	   * The allocation descriptor field is filled with short_ad's. | ||||
| 	   * If the offset is beyond the current extent, look for the | ||||
| 	   * next extent. | ||||
| 	   */ | ||||
| 	  do { | ||||
| 	    i_offset -= icblen; | ||||
| 	    ad_offset = sizeof(udf_short_ad_t) * ad_num; | ||||
| 	    if (ad_offset > uint32_from_le(p_udf_fe->i_alloc_descs)) { | ||||
| 	      cdio_warn("File offset out of bounds"); | ||||
| 	      return CDIO_INVALID_LBA; | ||||
| 	    } | ||||
| 	    p_icb = (udf_short_ad_t *)  | ||||
| 	      GETICB( uint32_from_le(p_udf_fe->i_extended_attr)  | ||||
| 		      + ad_offset ); | ||||
| 	    icblen = p_icb->len; | ||||
| 	    ad_num++; | ||||
| 	  } while(i_offset >= icblen); | ||||
| 	   | ||||
| 	  lsector = (i_offset / UDF_BLOCKSIZE) + p_icb->pos; | ||||
| 	   | ||||
| 	  *pi_max_size = p_icb->len; | ||||
| 	} | ||||
| 	break; | ||||
|       case ICBTAG_FLAG_AD_LONG:  | ||||
| 	{ | ||||
| 	  /*
 | ||||
| 	   * The allocation descriptor field is filled with long_ad's | ||||
| 	   * If the i_offset is beyond the current extent, look for the | ||||
| 	   * next extent. | ||||
| 	   */ | ||||
| 	  udf_long_ad_t *p_icb; | ||||
| 	  do { | ||||
| 	    i_offset -= icblen; | ||||
| 	    ad_offset = sizeof(udf_long_ad_t) * ad_num; | ||||
| 	    if (ad_offset > uint32_from_le(p_udf_fe->i_alloc_descs)) { | ||||
| 	      cdio_warn("File offset out of bounds"); | ||||
| 	      return CDIO_INVALID_LBA; | ||||
| 	    } | ||||
| 	    p_icb = (udf_long_ad_t *)  | ||||
| 	      GETICB( uint32_from_le(p_udf_fe->i_extended_attr) | ||||
| 		      + ad_offset ); | ||||
| 	    icblen = p_icb->len; | ||||
| 	    ad_num++; | ||||
| 	  } while(i_offset >= icblen); | ||||
| 	 | ||||
| 	  lsector = (i_offset / UDF_BLOCKSIZE) + | ||||
| 	    uint32_from_le(((udf_long_ad_t *)(p_icb))->loc.lba); | ||||
| 	   | ||||
| 	  *pi_max_size = p_icb->len; | ||||
| 	} | ||||
| 	break; | ||||
|       case ICBTAG_FLAG_AD_IN_ICB: | ||||
| 	/*
 | ||||
| 	 * This type means that the file *data* is stored in the | ||||
| 	 * allocation descriptor field of the file entry. | ||||
| 	 */ | ||||
| 	*pi_max_size = 0; | ||||
| 	cdio_warn("Don't know how to data in ICB handle yet"); | ||||
| 	return CDIO_INVALID_LBA; | ||||
|       case ICBTAG_FLAG_AD_EXTENDED: | ||||
| 	cdio_warn("Don't know how to handle extended addresses yet"); | ||||
| 	return CDIO_INVALID_LBA; | ||||
|       default: | ||||
| 	cdio_warn("Unsupported allocation descriptor %d", addr_ilk); | ||||
| 	return CDIO_INVALID_LBA; | ||||
|       } | ||||
| 
 | ||||
|       *pi_lba = (lba_t)lsector + p_udf->i_part_start; | ||||
|       if (*pi_lba < 0) { | ||||
| 	cdio_warn("Negative LBA value"); | ||||
| 	return CDIO_INVALID_LBA; | ||||
|       } | ||||
|       return *pi_lba; | ||||
|     } | ||||
|   default: | ||||
|     cdio_warn("Unknown strategy type %d", strat_type); | ||||
|     return DRIVER_OP_ERROR; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|   Attempts to read up to count bytes from UDF directory entry | ||||
|   p_udf_dirent into the buffer starting at buf. buf should be a | ||||
|   multiple of UDF_BLOCKSIZE bytes. Reading continues after the point | ||||
|   at which we last read or from the beginning the first time. | ||||
| 
 | ||||
|   If count is zero, read() returns zero and has no other results. If | ||||
|   count is greater than SSIZE_MAX, the result is unspecified. | ||||
| 
 | ||||
|   It is the caller's responsibility to ensure that count is less | ||||
|   than the number of blocks recorded via p_udf_dirent. | ||||
| 
 | ||||
|   If there is an error, cast the result to driver_return_code_t for  | ||||
|   the specific error code. | ||||
| */ | ||||
| ssize_t | ||||
| udf_read_block(const udf_dirent_t *p_udf_dirent, void * buf, size_t count) | ||||
| { | ||||
|   if (count == 0) return 0; | ||||
|   else { | ||||
|     driver_return_code_t ret; | ||||
|     uint32_t i_max_size=0; | ||||
|     udf_t *p_udf = p_udf_dirent->p_udf; | ||||
|     lba_t i_lba = offset_to_lba(p_udf_dirent, p_udf->i_position, &i_lba,  | ||||
| 				&i_max_size); | ||||
|     if (i_lba != CDIO_INVALID_LBA) { | ||||
|       uint32_t i_max_blocks = CEILING(i_max_size, UDF_BLOCKSIZE); | ||||
|       if ( i_max_blocks < count ) { | ||||
| 	  cdio_warn("read count %u is larger than %u extent size.", | ||||
| 		  (unsigned int)count, i_max_blocks); | ||||
| 	  cdio_warn("read count truncated to %u", (unsigned int)count); | ||||
| 	  count = i_max_blocks; | ||||
|       } | ||||
|       ret = udf_read_sectors(p_udf, buf, i_lba, count); | ||||
|       if (DRIVER_OP_SUCCESS == ret) { | ||||
| 	ssize_t i_read_len = MIN(i_max_size, count * UDF_BLOCKSIZE); | ||||
| 	p_udf->i_position += i_read_len; | ||||
| 	return i_read_len; | ||||
|       } | ||||
|       return ret; | ||||
|     } else { | ||||
|       return DRIVER_OP_ERROR; | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										706
									
								
								src/libcdio/udf/udf_fs.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										706
									
								
								src/libcdio/udf/udf_fs.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,706 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2006, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*
 | ||||
|  * Portions copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions | ||||
|  * are met: | ||||
|  * 1. Redistributions of source code must retain the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer. | ||||
|  * 2. Redistributions in binary form must reproduce the above copyright | ||||
|  *    notice, this list of conditions and the following disclaimer in the | ||||
|  *    documentation and/or other materials provided with the distribution. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||
|  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||||
|  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
|  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
|  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
|  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
|  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
|  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
|  * SUCH DAMAGE. | ||||
|  */ | ||||
| 
 | ||||
|  | ||||
| #ifdef HAVE_CONFIG_H | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDIO_H | ||||
| #include <stdio.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STRING_H | ||||
| # include <string.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDLIB_H | ||||
| # include <stdlib.h> | ||||
| #endif | ||||
| 
 | ||||
| /* These definitions are also to make debugging easy. Note that they
 | ||||
|    have to come *before* #include <cdio/ecma_167.h> which sets  | ||||
|    #defines for these. | ||||
| */ | ||||
| const char VSD_STD_ID_BEA01[] = {'B', 'E', 'A', '0', '1'}; | ||||
| const char VSD_STD_ID_BOOT2[] = {'B', 'O', 'O', 'T', '2'}; | ||||
| const char VSD_STD_ID_CD001[] = {'C', 'D', '0', '0', '1'}; | ||||
| const char VSD_STD_ID_CDW01[] = {'C', 'D', 'W', '0', '2'}; | ||||
| const char VSD_STD_ID_NSR03[] = {'N', 'S', 'R', '0', '3'}; | ||||
| const char VSD_STD_ID_TEA01[] = {'T', 'E', 'A', '0', '1'}; | ||||
| 
 | ||||
| #include <cdio/bytesex.h> | ||||
| #include "udf_private.h" | ||||
| #include "udf_fs.h" | ||||
| #include "cdio_assert.h" | ||||
| 
 | ||||
| /*
 | ||||
|  * The UDF specs are pretty clear on how each data structure is made | ||||
|  * up, but not very clear on how they relate to each other.  Here is | ||||
|  * the skinny... This demostrates a filesystem with one file in the | ||||
|  * root directory.  Subdirectories are treated just as normal files, | ||||
|  * but they have File Id Descriptors of their children as their file | ||||
|  * data.  As for the Anchor Volume Descriptor Pointer, it can exist in | ||||
|  * two of the following three places: sector 256, sector n (the max | ||||
|  * sector of the disk), or sector n - 256.  It's a pretty good bet | ||||
|  * that one will exist at sector 256 though.  One caveat is unclosed | ||||
|  * CD media.  For that, sector 256 cannot be written, so the Anchor | ||||
|  * Volume Descriptor Pointer can exist at sector 512 until the media | ||||
|  * is closed. | ||||
|  * | ||||
|  *  Sector: | ||||
|  *     256: | ||||
|  *       n: Anchor Volume Descriptor Pointer | ||||
|  * n - 256:	| | ||||
|  *		| | ||||
|  *		|-->Main Volume Descriptor Sequence | ||||
|  *			|	| | ||||
|  *			|	| | ||||
|  *			|	|-->Logical Volume Descriptor | ||||
|  *			|			  | | ||||
|  *			|-->Partition Descriptor  | | ||||
|  *				|		  | | ||||
|  *				|		  | | ||||
|  *				|-->Fileset Descriptor | ||||
|  *					| | ||||
|  *					| | ||||
|  *					|-->Root Dir File Entry | ||||
|  *						| | ||||
|  *						| | ||||
|  *						|-->File data: | ||||
|  *						    File Id Descriptor | ||||
|  *							| | ||||
|  *							| | ||||
|  *							|-->File Entry | ||||
|  *								| | ||||
|  *								| | ||||
|  *								|-->File data | ||||
|  */ | ||||
| 
 | ||||
| static udf_dirent_t * | ||||
| udf_new_dirent(udf_file_entry_t *p_udf_fe, udf_t *p_udf, | ||||
| 	       const char *psz_name, bool b_dir, bool b_parent); | ||||
| 
 | ||||
| /**
 | ||||
|  * Check the descriptor tag for both the correct id and correct checksum. | ||||
|  * Return zero if all is good, -1 if not. | ||||
|  */ | ||||
| int | ||||
| udf_checktag(const udf_tag_t *p_tag, udf_Uint16_t tag_id) | ||||
| { | ||||
|   uint8_t *itag; | ||||
|   uint8_t i; | ||||
|   uint8_t cksum = 0; | ||||
|    | ||||
|   itag = (uint8_t *)p_tag; | ||||
|    | ||||
|   if (p_tag->id != tag_id) | ||||
|     return -1; | ||||
|    | ||||
|   for (i = 0; i < 15; i++) | ||||
|     cksum = cksum + itag[i]; | ||||
|   cksum = cksum - itag[4]; | ||||
|    | ||||
|   if (cksum == p_tag->cksum) | ||||
|     return 0; | ||||
|    | ||||
|   return -1; | ||||
| } | ||||
| 
 | ||||
| bool  | ||||
| udf_get_lba(const udf_file_entry_t *p_udf_fe,  | ||||
| 	    /*out*/ uint32_t *start, /*out*/ uint32_t *end) | ||||
| { | ||||
|   if (! p_udf_fe->i_alloc_descs) | ||||
|     return false; | ||||
| 
 | ||||
|   switch (p_udf_fe->icb_tag.flags & ICBTAG_FLAG_AD_MASK) { | ||||
|   case ICBTAG_FLAG_AD_SHORT: | ||||
|     { | ||||
|       /* The allocation descriptor field is filled with short_ad's. */ | ||||
|       udf_short_ad_t *p_ad = (udf_short_ad_t *)  | ||||
| 	(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); | ||||
|        | ||||
|       *start = uint32_from_le(p_ad->pos); | ||||
|       *end = *start +  | ||||
| 	((uint32_from_le(p_ad->len) & UDF_LENGTH_MASK) - 1) / UDF_BLOCKSIZE; | ||||
|       return true; | ||||
|     } | ||||
|     break; | ||||
|   case ICBTAG_FLAG_AD_LONG: | ||||
|     { | ||||
|       /* The allocation descriptor field is filled with long_ad's */ | ||||
|       udf_long_ad_t *p_ad = (udf_long_ad_t *)  | ||||
| 	(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); | ||||
|        | ||||
|       *start = uint32_from_le(p_ad->loc.lba); /* ignore partition number */ | ||||
|       *end = *start +  | ||||
| 	((uint32_from_le(p_ad->len) & UDF_LENGTH_MASK) - 1) / UDF_BLOCKSIZE; | ||||
|       return true; | ||||
|     } | ||||
|     break; | ||||
|   case ICBTAG_FLAG_AD_EXTENDED: | ||||
|     { | ||||
|       udf_ext_ad_t *p_ad = (udf_ext_ad_t *) | ||||
| 	(p_udf_fe->u.ext_attr + p_udf_fe->i_extended_attr); | ||||
|        | ||||
|       *start = uint32_from_le(p_ad->ext_loc.lba); /* ignore partition number */ | ||||
|       *end = *start +  | ||||
| 	((uint32_from_le(p_ad->len) & UDF_LENGTH_MASK) - 1) / UDF_BLOCKSIZE; | ||||
|       return true; | ||||
|     } | ||||
|     break; | ||||
|   default: | ||||
|     return false; | ||||
|   } | ||||
|   return false; | ||||
| } | ||||
| 
 | ||||
| #define udf_PATH_DELIMITERS "/\\" | ||||
| 
 | ||||
| /* Searches p_udf_dirent a directory entry called psz_token.
 | ||||
|    Note p_udf_dirent is continuously updated. If the entry is | ||||
|    not found p_udf_dirent is useless and thus the caller should | ||||
|    not use it afterwards. | ||||
| */ | ||||
| static  | ||||
| udf_dirent_t * | ||||
| udf_ff_traverse(udf_dirent_t *p_udf_dirent, char *psz_token) | ||||
| { | ||||
|   while (udf_readdir(p_udf_dirent)) { | ||||
|     if (strcmp(psz_token, p_udf_dirent->psz_name) == 0) { | ||||
|       char *next_tok = strtok(NULL, udf_PATH_DELIMITERS); | ||||
|        | ||||
|       if (!next_tok) | ||||
| 	return p_udf_dirent; /* found */ | ||||
|       else if (p_udf_dirent->b_dir) { | ||||
| 	udf_dirent_t * p_udf_dirent2 = udf_opendir(p_udf_dirent); | ||||
| 	 | ||||
| 	if (p_udf_dirent2) { | ||||
| 	  udf_dirent_t * p_udf_dirent3 =  | ||||
| 	    udf_ff_traverse(p_udf_dirent2, next_tok); | ||||
| 
 | ||||
| 	  /* if p_udf_dirent3 is null p_udf_dirent2 is free'd. */ | ||||
| 	  return p_udf_dirent3; | ||||
| 	} | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   free(p_udf_dirent->psz_name); | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| /* FIXME! */ | ||||
| #define udf_MAX_PATHLEN 2048 | ||||
| 
 | ||||
| udf_dirent_t *  | ||||
| udf_fopen(udf_dirent_t *p_udf_root, const char *psz_name) | ||||
| { | ||||
|   udf_dirent_t *p_udf_file = NULL; | ||||
|    | ||||
|   if (p_udf_root) { | ||||
|     char tokenline[udf_MAX_PATHLEN]; | ||||
|     char *psz_token; | ||||
| 
 | ||||
|     /* file position must be reset when accessing a new file */ | ||||
|     p_udf_root->p_udf->i_position = 0; | ||||
| 
 | ||||
|     strncpy(tokenline, psz_name, udf_MAX_PATHLEN); | ||||
|     psz_token = strtok(tokenline, udf_PATH_DELIMITERS); | ||||
|     if (psz_token) { | ||||
|       /*** FIXME??? udf_dirent can be variable size due to the
 | ||||
| 	   extended attributes and descriptors. Given that, is this | ||||
| 	   correct?  | ||||
|        */ | ||||
|       udf_dirent_t *p_udf_dirent =  | ||||
| 	udf_new_dirent(&p_udf_root->fe, p_udf_root->p_udf, | ||||
| 		       p_udf_root->psz_name, p_udf_root->b_dir,  | ||||
| 		       p_udf_root->b_parent); | ||||
|       p_udf_file = udf_ff_traverse(p_udf_dirent, psz_token); | ||||
|       udf_dirent_free(p_udf_dirent); | ||||
|     } | ||||
|     else if ( 0 == strncmp("/", psz_name, sizeof("/")) ) { | ||||
|       return udf_new_dirent(&p_udf_root->fe, p_udf_root->p_udf, | ||||
| 			    p_udf_root->psz_name, p_udf_root->b_dir,  | ||||
| 			    p_udf_root->b_parent); | ||||
|     } | ||||
|   } | ||||
|   return p_udf_file; | ||||
| } | ||||
| 
 | ||||
| /* Convert unicode16 to 8-bit char by dripping MSB. 
 | ||||
|    Wonder if iconv can be used here | ||||
| */ | ||||
| static int  | ||||
| unicode16_decode( const uint8_t *data, int i_len, char *target )  | ||||
| { | ||||
|   int p = 1, i = 0; | ||||
|    | ||||
|   if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do { | ||||
|     if( data[ 0 ] == 16 ) p++;  /* Ignore MSB of unicode16 */ | ||||
|     if( p < i_len ) { | ||||
|       target[ i++ ] = data[ p++ ]; | ||||
|     } | ||||
|   } while( p < i_len ); | ||||
|    | ||||
|   target[ i ] = '\0'; | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| static udf_dirent_t * | ||||
| udf_new_dirent(udf_file_entry_t *p_udf_fe, udf_t *p_udf, | ||||
| 	       const char *psz_name, bool b_dir, bool b_parent)  | ||||
| { | ||||
|   udf_dirent_t *p_udf_dirent = (udf_dirent_t *)  | ||||
|     calloc(1, sizeof(udf_dirent_t)); | ||||
|   if (!p_udf_dirent) return NULL; | ||||
|    | ||||
|   p_udf_dirent->psz_name     = strdup(psz_name); | ||||
|   p_udf_dirent->b_dir        = b_dir; | ||||
|   p_udf_dirent->b_parent     = b_parent; | ||||
|   p_udf_dirent->p_udf        = p_udf; | ||||
|   p_udf_dirent->i_part_start = p_udf->i_part_start; | ||||
|   p_udf_dirent->dir_left     = uint64_from_le(p_udf_fe->info_len);  | ||||
| 
 | ||||
|   memcpy(&(p_udf_dirent->fe), p_udf_fe,  | ||||
| 	 sizeof(udf_file_entry_t)); | ||||
|   udf_get_lba( p_udf_fe, &(p_udf_dirent->i_loc),  | ||||
| 	       &(p_udf_dirent->i_loc_end) ); | ||||
|   return p_udf_dirent; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Seek to a position i_start and then read i_blocks. Number of blocks read is  | ||||
|   returned. One normally expects the return to be equal to i_blocks. | ||||
| */ | ||||
| driver_return_code_t | ||||
| udf_read_sectors (const udf_t *p_udf, void *ptr, lsn_t i_start,  | ||||
| 		 long i_blocks)  | ||||
| { | ||||
|   driver_return_code_t ret; | ||||
|   long i_read; | ||||
|   off_t i_byte_offset; | ||||
|    | ||||
|   if (!p_udf) return 0; | ||||
|   /* Without the cast, i_start * UDF_BLOCKSIZE may be evaluated as 32 bit */ | ||||
|   i_byte_offset = ((off_t)i_start) * UDF_BLOCKSIZE; | ||||
|   /* Since we're using SEEK_SET, the value must be positive */ | ||||
|   if (i_byte_offset < 0) { | ||||
|     if (sizeof(off_t) <= 4)	/* probably missing LFS */ | ||||
|       cdio_warn("Large File Support is required to access streams of 2 GB or more"); | ||||
|     return DRIVER_OP_BAD_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   if (p_udf->b_stream) { | ||||
|     ret = cdio_stream_seek (p_udf->stream, i_byte_offset, SEEK_SET); | ||||
|     if (DRIVER_OP_SUCCESS != ret) return ret; | ||||
|     i_read = cdio_stream_read (p_udf->stream, ptr, UDF_BLOCKSIZE, i_blocks); | ||||
|     if (i_read) return DRIVER_OP_SUCCESS; | ||||
|     return DRIVER_OP_ERROR; | ||||
|   } else { | ||||
|     return cdio_read_data_sectors(p_udf->cdio, ptr, i_start, UDF_BLOCKSIZE, | ||||
| 				  i_blocks); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Open an UDF for reading. Maybe in the future we will have | ||||
|   a mode. NULL is returned on error. | ||||
| 
 | ||||
|   Caller must free result - use udf_close for that. | ||||
| */ | ||||
| udf_t * | ||||
| udf_open (const char *psz_path) | ||||
| { | ||||
|   udf_t *p_udf = (udf_t *) calloc(1, sizeof(udf_t)) ; | ||||
|   uint8_t data[UDF_BLOCKSIZE]; | ||||
| 
 | ||||
|   if (!p_udf) return NULL; | ||||
| 
 | ||||
|   /* Sanity check */ | ||||
|   cdio_assert(sizeof(udf_file_entry_t) == UDF_BLOCKSIZE); | ||||
| 
 | ||||
|   p_udf->cdio = cdio_open(psz_path, DRIVER_UNKNOWN); | ||||
|   if (!p_udf->cdio) { | ||||
|     /* Not a CD-ROM drive or CD Image. Maybe it's a UDF file not
 | ||||
|        encapsulated as a CD-ROM Image (e.g. often .UDF or (sic) .ISO) | ||||
|     */ | ||||
|     p_udf->stream = cdio_stdio_new( psz_path ); | ||||
|     if (!p_udf->stream)  | ||||
|       goto error; | ||||
|     p_udf->b_stream = true; | ||||
|   } | ||||
| 
 | ||||
|   /*
 | ||||
|    * Look for an Anchor Volume Descriptor Pointer at sector 256. | ||||
|    */ | ||||
|   if (DRIVER_OP_SUCCESS != udf_read_sectors (p_udf, &data, 256, 1) ) | ||||
|     goto error; | ||||
|    | ||||
|   memcpy(&(p_udf->anchor_vol_desc_ptr), &data, sizeof(anchor_vol_desc_ptr_t)); | ||||
| 
 | ||||
|   if (udf_checktag((udf_tag_t *)&(p_udf->anchor_vol_desc_ptr), TAGID_ANCHOR)) | ||||
|     goto error; | ||||
|    | ||||
|   /*
 | ||||
|    * Then try to find a reference to a Primary Volume Descriptor. | ||||
|    */ | ||||
|   { | ||||
|     const anchor_vol_desc_ptr_t *p_avdp = &p_udf->anchor_vol_desc_ptr; | ||||
|     const uint32_t mvds_start =  | ||||
|       uint32_from_le(p_avdp->main_vol_desc_seq_ext.loc); | ||||
|     const uint32_t mvds_end   = mvds_start +  | ||||
|       (uint32_from_le(p_avdp->main_vol_desc_seq_ext.len) - 1) / UDF_BLOCKSIZE; | ||||
| 
 | ||||
|     uint32_t i_lba; | ||||
| 
 | ||||
|     for (i_lba = mvds_start; i_lba < mvds_end; i_lba++) { | ||||
| 
 | ||||
|       udf_pvd_t *p_pvd = (udf_pvd_t *) &data; | ||||
|        | ||||
|       if (DRIVER_OP_SUCCESS != udf_read_sectors (p_udf, p_pvd, i_lba, 1) )  | ||||
| 	goto error; | ||||
| 
 | ||||
|       if (!udf_checktag(&p_pvd->tag, TAGID_PRI_VOL)) { | ||||
| 	p_udf->pvd_lba = i_lba; | ||||
| 	break; | ||||
|       } | ||||
|        | ||||
|     } | ||||
| 
 | ||||
|     /*
 | ||||
|      * If we couldn't find a reference, bail out. | ||||
|      */ | ||||
|     if (i_lba == mvds_end) | ||||
|       goto error; | ||||
|   } | ||||
| 
 | ||||
|   return p_udf; | ||||
| 
 | ||||
|  error: | ||||
|   cdio_stdio_destroy(p_udf->stream); | ||||
|   free(p_udf); | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * Gets the Volume Identifier string, in 8bit unicode (latin-1) | ||||
|  * psz_volid, place to put the string | ||||
|  * i_volid_size, size of the buffer volid points to | ||||
|  * returns the size of buffer needed for all data | ||||
|  */ | ||||
| int  | ||||
| udf_get_volume_id(udf_t *p_udf, /*out*/ char *psz_volid,  unsigned int i_volid) | ||||
| { | ||||
|   uint8_t data[UDF_BLOCKSIZE]; | ||||
|   const udf_pvd_t *p_pvd = (udf_pvd_t *) &data; | ||||
|   unsigned int volid_len; | ||||
| 
 | ||||
|   /* get primary volume descriptor */ | ||||
|   if ( DRIVER_OP_SUCCESS != udf_read_sectors(p_udf, &data, p_udf->pvd_lba, 1) ) | ||||
|     return 0; | ||||
| 
 | ||||
|   volid_len = p_pvd->vol_ident[UDF_VOLID_SIZE-1]; | ||||
|   if(volid_len > UDF_VOLID_SIZE-1) { | ||||
|     /* this field is only UDF_VOLID_SIZE bytes something is wrong */ | ||||
|     volid_len = UDF_VOLID_SIZE-1; | ||||
|   } | ||||
|   if(i_volid > volid_len) { | ||||
|     i_volid = volid_len; | ||||
|   } | ||||
|   unicode16_decode((uint8_t *) p_pvd->vol_ident, i_volid, psz_volid); | ||||
|    | ||||
|   return volid_len; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * Gets the Volume Set Identifier, as a 128-byte dstring (not decoded) | ||||
|  * WARNING This is not a null terminated string | ||||
|  * volsetid, place to put the data | ||||
|  * volsetid_size, size of the buffer volsetid points to  | ||||
|  * the buffer should be >=128 bytes to store the whole volumesetidentifier | ||||
|  * returns the size of the available volsetid information (128) | ||||
|  * or 0 on error | ||||
|  */ | ||||
| int  | ||||
| udf_get_volumeset_id(udf_t *p_udf, /*out*/ uint8_t *volsetid, | ||||
| 		     unsigned int i_volsetid) | ||||
| { | ||||
|   uint8_t data[UDF_BLOCKSIZE]; | ||||
|   const udf_pvd_t *p_pvd = (udf_pvd_t *) &data; | ||||
| 
 | ||||
|   /* get primary volume descriptor */ | ||||
|   if ( DRIVER_OP_SUCCESS != udf_read_sectors(p_udf, &data, p_udf->pvd_lba, 1) ) | ||||
|     return 0; | ||||
| 
 | ||||
|   if (i_volsetid > UDF_VOLSET_ID_SIZE) { | ||||
|     i_volsetid = UDF_VOLSET_ID_SIZE; | ||||
|   } | ||||
|    | ||||
|   memcpy(volsetid, p_pvd->volset_id, i_volsetid); | ||||
|    | ||||
|   return UDF_VOLSET_ID_SIZE; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Get the root in p_udf. If b_any_partition is false then | ||||
|   the root must be in the given partition. | ||||
|   NULL is returned if the partition is not found or a root is not found or | ||||
|   there is on error. | ||||
| 
 | ||||
|   Caller must free result - use udf_dirent_free for that. | ||||
| */ | ||||
| udf_dirent_t * | ||||
| udf_get_root (udf_t *p_udf, bool b_any_partition, partition_num_t i_partition) | ||||
| { | ||||
|   const anchor_vol_desc_ptr_t *p_avdp = &p_udf->anchor_vol_desc_ptr; | ||||
|   const uint32_t mvds_start =  | ||||
|     uint32_from_le(p_avdp->main_vol_desc_seq_ext.loc); | ||||
|   const uint32_t mvds_end   = mvds_start +  | ||||
|     (uint32_from_le(p_avdp->main_vol_desc_seq_ext.len) - 1) / UDF_BLOCKSIZE; | ||||
|   uint32_t i_lba; | ||||
|   uint8_t data[UDF_BLOCKSIZE]; | ||||
| 
 | ||||
|   /* 
 | ||||
|      Now we have the joy of finding the Partition Descriptor and the | ||||
|      Logical Volume Descriptor for the Main Volume Descriptor | ||||
|      Sequence. Once we've got that, we use the Logical Volume | ||||
|      Descriptor to get a Fileset Descriptor and that has the Root | ||||
|      Directory File Entry. | ||||
|   */ | ||||
|   for (i_lba = mvds_start; i_lba < mvds_end; i_lba++) { | ||||
|     uint8_t data2[UDF_BLOCKSIZE]; | ||||
|      | ||||
|     partition_desc_t *p_partition = (partition_desc_t *) &data2; | ||||
|      | ||||
|     if (DRIVER_OP_SUCCESS != udf_read_sectors (p_udf, p_partition, i_lba, 1) )  | ||||
|       return NULL; | ||||
|      | ||||
|     if (!udf_checktag(&p_partition->tag, TAGID_PARTITION)) { | ||||
|       const partition_num_t i_partition_check  | ||||
| 	= uint16_from_le(p_partition->number); | ||||
|       if (b_any_partition || i_partition_check == i_partition) { | ||||
| 	/* Squirrel away some data regarding partition */ | ||||
| 	p_udf->i_partition = uint16_from_le(p_partition->number); | ||||
| 	p_udf->i_part_start = uint32_from_le(p_partition->start_loc); | ||||
| 	if (p_udf->lvd_lba) break; | ||||
|       } | ||||
|     } else if (!udf_checktag(&p_partition->tag, TAGID_LOGVOL)) { | ||||
|       /* Get fileset descriptor */ | ||||
|       logical_vol_desc_t *p_logvol = (logical_vol_desc_t *) &data2; | ||||
|       bool b_valid =  | ||||
| 	UDF_BLOCKSIZE == uint32_from_le(p_logvol->logical_blocksize); | ||||
|        | ||||
|       if (b_valid) { | ||||
| 	p_udf->lvd_lba = i_lba; | ||||
| 	p_udf->fsd_offset =  | ||||
| 	  uint32_from_le(p_logvol->lvd_use.fsd_loc.loc.lba); | ||||
| 	if (p_udf->i_part_start) break; | ||||
|       } | ||||
|     }  | ||||
|   } | ||||
|   if (p_udf->lvd_lba && p_udf->i_part_start) { | ||||
|     udf_fsd_t *p_fsd = (udf_fsd_t *) &data; | ||||
|      | ||||
|     driver_return_code_t ret =  | ||||
|       udf_read_sectors(p_udf, p_fsd, p_udf->i_part_start + p_udf->fsd_offset, | ||||
| 		       1); | ||||
|      | ||||
|     if (DRIVER_OP_SUCCESS == ret && !udf_checktag(&p_fsd->tag, TAGID_FSD)) { | ||||
|       udf_file_entry_t *p_udf_fe = (udf_file_entry_t *) &data; | ||||
|       const uint32_t parent_icb = uint32_from_le(p_fsd->root_icb.loc.lba); | ||||
|        | ||||
|       /* Check partition numbers match of last-read block?  */ | ||||
|        | ||||
|       ret = udf_read_sectors(p_udf, p_udf_fe,  | ||||
| 			     p_udf->i_part_start + parent_icb, 1); | ||||
|       if (ret == DRIVER_OP_SUCCESS &&  | ||||
| 	  !udf_checktag(&p_udf_fe->tag, TAGID_FILE_ENTRY)) { | ||||
| 	 | ||||
| 	/* Check partition numbers match of last-read block? */ | ||||
| 	 | ||||
| 	/* We win! - Save root directory information. */ | ||||
| 	return udf_new_dirent(p_udf_fe, p_udf, "/", true, false ); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| #define free_and_null(x) \ | ||||
|   free(x);		 \ | ||||
|   x=NULL		  | ||||
| 
 | ||||
| /*!
 | ||||
|   Close UDF and free resources associated with p_udf. | ||||
| */ | ||||
| bool  | ||||
| udf_close (udf_t *p_udf)  | ||||
| { | ||||
|   if (!p_udf) return true; | ||||
|   if (p_udf->b_stream) { | ||||
|     cdio_stdio_destroy(p_udf->stream); | ||||
|   } else { | ||||
|     cdio_destroy(p_udf->cdio); | ||||
|   } | ||||
| 
 | ||||
|   /* Get rid of root directory if allocated. */ | ||||
| 
 | ||||
|   free_and_null(p_udf); | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| udf_dirent_t *  | ||||
| udf_opendir(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   if (p_udf_dirent->b_dir && !p_udf_dirent->b_parent && p_udf_dirent->fid) { | ||||
|     udf_t *p_udf = p_udf_dirent->p_udf; | ||||
|     udf_file_entry_t udf_fe; | ||||
|      | ||||
|     driver_return_code_t i_ret =  | ||||
|       udf_read_sectors(p_udf, &udf_fe, p_udf->i_part_start  | ||||
| 		       + p_udf_dirent->fid->icb.loc.lba, 1); | ||||
| 
 | ||||
|     if (DRIVER_OP_SUCCESS == i_ret  | ||||
| 	&& !udf_checktag(&udf_fe.tag, TAGID_FILE_ENTRY)) { | ||||
|        | ||||
|       if (ICBTAG_FILE_TYPE_DIRECTORY == udf_fe.icb_tag.file_type) { | ||||
| 	udf_dirent_t *p_udf_dirent_new =  | ||||
| 	  udf_new_dirent(&udf_fe, p_udf, p_udf_dirent->psz_name, true, true); | ||||
| 	return p_udf_dirent_new; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| udf_dirent_t * | ||||
| udf_readdir(udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   udf_t *p_udf; | ||||
|    | ||||
|   if (p_udf_dirent->dir_left <= 0) { | ||||
|     udf_dirent_free(p_udf_dirent); | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   /* file position must be reset when accessing a new file */ | ||||
|   p_udf = p_udf_dirent->p_udf; | ||||
|   p_udf->i_position = 0; | ||||
| 
 | ||||
|   if (p_udf_dirent->fid) {  | ||||
|     /* advance to next File Identifier Descriptor */ | ||||
|     /* FIXME: need to advance file entry (fe) as well.  */ | ||||
|     uint32_t ofs = 4 *  | ||||
|       ((sizeof(*(p_udf_dirent->fid)) + p_udf_dirent->fid->i_imp_use  | ||||
| 	+ p_udf_dirent->fid->i_file_id + 3) / 4); | ||||
|      | ||||
|     p_udf_dirent->fid =  | ||||
|       (udf_fileid_desc_t *)((uint8_t *)p_udf_dirent->fid + ofs); | ||||
|   } | ||||
|    | ||||
|   if (!p_udf_dirent->fid) { | ||||
|     uint32_t i_sectors =  | ||||
|       (p_udf_dirent->i_loc_end - p_udf_dirent->i_loc + 1); | ||||
|     uint32_t size = UDF_BLOCKSIZE * i_sectors; | ||||
|     driver_return_code_t i_ret; | ||||
| 
 | ||||
|     if (!p_udf_dirent->sector) | ||||
|       p_udf_dirent->sector = (uint8_t*) malloc(size); | ||||
|     i_ret = udf_read_sectors(p_udf, p_udf_dirent->sector,  | ||||
| 			     p_udf_dirent->i_part_start+p_udf_dirent->i_loc,  | ||||
| 			     i_sectors); | ||||
|     if (DRIVER_OP_SUCCESS == i_ret) | ||||
|       p_udf_dirent->fid = (udf_fileid_desc_t *) p_udf_dirent->sector; | ||||
|     else | ||||
|       p_udf_dirent->fid = NULL; | ||||
|   } | ||||
|    | ||||
|   if (p_udf_dirent->fid && !udf_checktag(&(p_udf_dirent->fid->tag), TAGID_FID)) | ||||
|     { | ||||
|       uint32_t ofs =  | ||||
| 	4 * ((sizeof(*p_udf_dirent->fid) + p_udf_dirent->fid->i_imp_use  | ||||
| 	      + p_udf_dirent->fid->i_file_id + 3) / 4); | ||||
|        | ||||
|       p_udf_dirent->dir_left -= ofs; | ||||
|       p_udf_dirent->b_dir =  | ||||
| 	(p_udf_dirent->fid->file_characteristics & UDF_FILE_DIRECTORY) != 0; | ||||
|       p_udf_dirent->b_parent =  | ||||
| 	(p_udf_dirent->fid->file_characteristics & UDF_FILE_PARENT) != 0; | ||||
| 
 | ||||
|       { | ||||
| 	const unsigned int i_len = p_udf_dirent->fid->i_file_id; | ||||
| 
 | ||||
| 	if (DRIVER_OP_SUCCESS != udf_read_sectors(p_udf, &p_udf_dirent->fe, p_udf->i_part_start  | ||||
| 			 + p_udf_dirent->fid->icb.loc.lba, 1)) | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	if (strlen(p_udf_dirent->psz_name) < i_len)  | ||||
| 	  p_udf_dirent->psz_name = (char *) | ||||
| 	    realloc(p_udf_dirent->psz_name, sizeof(char)*i_len+1); | ||||
| 	 | ||||
| 	unicode16_decode(p_udf_dirent->fid->u.imp_use  | ||||
| 			 + p_udf_dirent->fid->i_imp_use,  | ||||
| 			 i_len, p_udf_dirent->psz_name); | ||||
|       } | ||||
|       return p_udf_dirent; | ||||
|     } | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   free free resources associated with p_udf_dirent. | ||||
| */ | ||||
| bool  | ||||
| udf_dirent_free(udf_dirent_t *p_udf_dirent)  | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     p_udf_dirent->fid = NULL; | ||||
|     free_and_null(p_udf_dirent->psz_name); | ||||
|     free_and_null(p_udf_dirent->sector); | ||||
|     free_and_null(p_udf_dirent); | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
							
								
								
									
										39
									
								
								src/libcdio/udf/udf_fs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/libcdio/udf/udf_fs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| /*
 | ||||
|   $Id: udf_fs.h,v 1.3 2008/04/18 16:02:10 karl Exp $ | ||||
| 
 | ||||
|   Copyright (C) 2006, 2008 Rocky Bernstein <rockyb@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_UDF_FS_H__ | ||||
| #define __CDIO_UDF_FS_H__ | ||||
| 
 | ||||
| #include <cdio/ecma_167.h> | ||||
| /**
 | ||||
|  * Check the descriptor tag for both the correct id and correct checksum. | ||||
|  * Return zero if all is good, -1 if not. | ||||
|  */ | ||||
| int udf_checktag(const udf_tag_t *p_tag, udf_Uint16_t tag_id); | ||||
| 
 | ||||
| #endif /* __CDIO_UDF_FS_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										55
									
								
								src/libcdio/udf/udf_private.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/libcdio/udf/udf_private.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| /*
 | ||||
|   Copyright (C) 2005, 2006, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_UDF_PRIVATE_H__ | ||||
| #define __CDIO_UDF_PRIVATE_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) && !defined(__CDIO_CONFIG_H__) | ||||
| # include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/ecma_167.h> | ||||
| #include <cdio/udf.h> | ||||
| #include "_cdio_stdio.h" | ||||
| 
 | ||||
| /* Implementation of opaque types */ | ||||
| 
 | ||||
| struct udf_s { | ||||
|   bool                  b_stream;     /* Use stream pointer, else use p_cdio */ | ||||
|   off_t                 i_position;   /* Position in file if positive */ | ||||
|   CdioDataSource_t      *stream;      /* Stream pointer if stream */ | ||||
|   CdIo_t                *cdio;        /* Cdio pointer if read device */ | ||||
|   anchor_vol_desc_ptr_t anchor_vol_desc_ptr; | ||||
|   uint32_t              pvd_lba;      /* sector of Primary Volume Descriptor */ | ||||
|   partition_num_t       i_partition;  /* partition number */ | ||||
|   uint32_t              i_part_start; /* start of Partition Descriptor */ | ||||
|   uint32_t              lvd_lba;      /* sector of Logical Volume Descriptor */ | ||||
|   uint32_t              fsd_offset;   /* lba of fileset descriptor */ | ||||
| }; | ||||
| 
 | ||||
| #endif /* __CDIO_UDF_PRIVATE_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
							
								
								
									
										254
									
								
								src/libcdio/udf/udf_time.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										254
									
								
								src/libcdio/udf/udf_time.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,254 @@ | |||
| /* 
 | ||||
|   Copyright (C) 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> | ||||
|   Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | ||||
| 
 | ||||
|   Modified From part of the GNU C Library. | ||||
|   Contributed by Paul Eggert. | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 of the License, or | ||||
|   (at your option) any later version. | ||||
| 
 | ||||
|   This program is distributed in the hope that it will be useful, | ||||
|   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|   GNU General Public License for more details. | ||||
| 
 | ||||
|   You should have received a copy of the GNU General Public License | ||||
|   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /* Some history from the GNU/Linux kernel from which this is also taken...
 | ||||
|    dgb 10/02/98: ripped this from glibc source to help convert | ||||
|                  timestamps to unix time | ||||
| 
 | ||||
|        10/04/98: added new table-based lookup after seeing how ugly the | ||||
|                  gnu code is | ||||
|    | ||||
|    blf 09/27/99: ripped out all the old code and inserted new table from | ||||
|                  John Brockmeyer (without leap second corrections) | ||||
|                  rewrote udf_stamp_to_time and fixed timezone | ||||
|                  accounting in udf_timespec_to_stamp. | ||||
| */ | ||||
| 
 | ||||
| /*
 | ||||
|  * We don't take into account leap seconds. This may be correct or incorrect. | ||||
|  * For more NIST information (especially dealing with leap seconds), see: | ||||
|  *  http://www.boulder.nist.gov/timefreq/pubs/bulletin/leapsecond.htm
 | ||||
|  */ | ||||
| 
 | ||||
| #ifdef HAVE_CONFIG_H | ||||
| #include "config.h" | ||||
| # define __CDIO_CONFIG_H__ 1 | ||||
| #endif | ||||
| 
 | ||||
| #ifdef NEED_TIMEZONEVAR | ||||
| #define timezonevar 1 | ||||
| #endif | ||||
| 
 | ||||
| #include "udf_private.h" | ||||
| #include <cdio/udf.h> | ||||
| 
 | ||||
| /**
 | ||||
|    Imagine the below enum values as #define'd or constant values | ||||
|    rather than distinct values of an enum. | ||||
| */ | ||||
| enum { | ||||
|   HOURS_PER_DAY    =   24, | ||||
|   SECS_PER_MINUTE  =   60, | ||||
|   MAX_YEAR_SECONDS =   69, | ||||
|   DAYS_PER_YEAR    =  365,  /* That is, in most of the years. */ | ||||
|   EPOCH_YEAR       = 1970, | ||||
|   SECS_PER_HOUR	   = (60 * SECS_PER_MINUTE), | ||||
|   SECS_PER_DAY	   = SECS_PER_HOUR * HOURS_PER_DAY | ||||
| } debug_udf_time_enum; | ||||
|    | ||||
| #ifndef __isleap | ||||
| /* Nonzero if YEAR is a leap year (every 4 years,
 | ||||
|    except every 100th isn't, and every 400th is).  */ | ||||
| #define	__isleap(year)	\ | ||||
|   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) | ||||
| #endif | ||||
| 
 | ||||
| /* How many days come before each month (0-12).  */ | ||||
| static const unsigned short int __mon_yday[2][13] = | ||||
|   { | ||||
|     /* Normal years.  */ | ||||
|     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, DAYS_PER_YEAR }, | ||||
|     /* Leap years.  */ | ||||
|     { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, DAYS_PER_YEAR+1 } | ||||
|   }; | ||||
| 
 | ||||
| #define SPY(y,l,s) (SECS_PER_DAY * (DAYS_PER_YEAR*y+l)+s) /* Seconds per year */ | ||||
| 
 | ||||
| static time_t year_seconds[MAX_YEAR_SECONDS]= { | ||||
|   /*1970*/ SPY( 0, 0,0), SPY( 1, 0,0), SPY( 2, 0,0), SPY( 3, 1,0),  | ||||
|   /*1974*/ SPY( 4, 1,0), SPY( 5, 1,0), SPY( 6, 1,0), SPY( 7, 2,0),  | ||||
|   /*1978*/ SPY( 8, 2,0), SPY( 9, 2,0), SPY(10, 2,0), SPY(11, 3,0),  | ||||
|   /*1982*/ SPY(12, 3,0), SPY(13, 3,0), SPY(14, 3,0), SPY(15, 4,0),  | ||||
|   /*1986*/ SPY(16, 4,0), SPY(17, 4,0), SPY(18, 4,0), SPY(19, 5,0),  | ||||
|   /*1990*/ SPY(20, 5,0), SPY(21, 5,0), SPY(22, 5,0), SPY(23, 6,0),  | ||||
|   /*1994*/ SPY(24, 6,0), SPY(25, 6,0), SPY(26, 6,0), SPY(27, 7,0),  | ||||
|   /*1998*/ SPY(28, 7,0), SPY(29, 7,0), SPY(30, 7,0), SPY(31, 8,0),  | ||||
|   /*2002*/ SPY(32, 8,0), SPY(33, 8,0), SPY(34, 8,0), SPY(35, 9,0),  | ||||
|   /*2006*/ SPY(36, 9,0), SPY(37, 9,0), SPY(38, 9,0), SPY(39,10,0),  | ||||
|   /*2010*/ SPY(40,10,0), SPY(41,10,0), SPY(42,10,0), SPY(43,11,0),  | ||||
|   /*2014*/ SPY(44,11,0), SPY(45,11,0), SPY(46,11,0), SPY(47,12,0),  | ||||
|   /*2018*/ SPY(48,12,0), SPY(49,12,0), SPY(50,12,0), SPY(51,13,0),  | ||||
|   /*2022*/ SPY(52,13,0), SPY(53,13,0), SPY(54,13,0), SPY(55,14,0),  | ||||
|   /*2026*/ SPY(56,14,0), SPY(57,14,0), SPY(58,14,0), SPY(59,15,0),  | ||||
|   /*2030*/ SPY(60,15,0), SPY(61,15,0), SPY(62,15,0), SPY(63,16,0),  | ||||
|   /*2034*/ SPY(64,16,0), SPY(65,16,0), SPY(66,16,0), SPY(67,17,0),  | ||||
|   /*2038*/ SPY(68,17,0) | ||||
| }; | ||||
| 
 | ||||
| #if defined(HAVE_TIMEZONE_VAR) && !defined(_WIN32) | ||||
| extern long timezone; | ||||
| #endif | ||||
| 
 | ||||
| time_t * | ||||
| udf_stamp_to_time(time_t *dest, long int *dest_usec,  | ||||
| 		  const udf_timestamp_t src) | ||||
| { | ||||
|   int yday; | ||||
|   uint8_t type = src.type_tz >> 12; | ||||
|   int16_t offset; | ||||
|    | ||||
|   if (type == 1) { | ||||
|     offset = src.type_tz << 4; | ||||
|     /* sign extent offset */ | ||||
|     offset = (offset >> 4); | ||||
|     if (offset == -2047) /* unspecified offset */ | ||||
|       offset = 0; | ||||
|   } | ||||
|   else | ||||
|     offset = 0; | ||||
|    | ||||
|   if ((src.year < EPOCH_YEAR) || | ||||
|       (src.year >= EPOCH_YEAR+MAX_YEAR_SECONDS)) | ||||
|     { | ||||
|       *dest = -1; | ||||
|       *dest_usec = -1; | ||||
|       return NULL; | ||||
|     } | ||||
|   *dest = year_seconds[src.year - EPOCH_YEAR]; | ||||
|   *dest -= offset * SECS_PER_MINUTE; | ||||
|    | ||||
|   yday = ((__mon_yday[__isleap (src.year)] | ||||
| 	   [src.month-1]) + (src.day-1)); | ||||
|   *dest += src.second +  | ||||
|     ( SECS_PER_MINUTE * | ||||
|       ( ( (yday* HOURS_PER_DAY) + src.hour ) * 60 + src.minute ) ); | ||||
| 
 | ||||
|   *dest_usec = src.microseconds | ||||
|     + (src.centiseconds * 10000) | ||||
|     + (src.hundreds_of_microseconds * 100); | ||||
|   return dest; | ||||
| } | ||||
| 
 | ||||
| #ifdef HAVE_STRUCT_TIMESPEC | ||||
| /*!
 | ||||
|   Convert a UDF timestamp to a time_t. If microseconds are desired, | ||||
|   use dest_usec. The return value is the same as dest. */ | ||||
| udf_timestamp_t * | ||||
| udf_timespec_to_stamp(const struct timespec ts, udf_timestamp_t *dest) | ||||
| { | ||||
|   long int days, rem, y; | ||||
|   const unsigned short int *ip; | ||||
|   int16_t offset = 0; | ||||
|   int16_t tv_sec; | ||||
| 
 | ||||
| #ifdef HAVE_TIMEZONE_VAR   | ||||
|   offset = -timezone; | ||||
| #endif | ||||
|    | ||||
|   if (!dest) | ||||
|     return dest; | ||||
|    | ||||
|   dest->type_tz = 0x1000 | (offset & 0x0FFF); | ||||
|    | ||||
|   tv_sec       = ts.tv_sec + (offset * SECS_PER_MINUTE); | ||||
|   days         = tv_sec / SECS_PER_DAY; | ||||
|   rem          = tv_sec % SECS_PER_DAY; | ||||
|   dest->hour   = rem / SECS_PER_HOUR; | ||||
|   rem         %= SECS_PER_HOUR; | ||||
|   dest->minute = rem / SECS_PER_MINUTE; | ||||
|   dest->second = rem % SECS_PER_MINUTE; | ||||
|   y            = EPOCH_YEAR; | ||||
|    | ||||
| #define DIV(a,b) ((a) / (b) - ((a) % (b) < 0)) | ||||
| #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) | ||||
|    | ||||
|   while (days < 0 || days >= (__isleap(y) ? DAYS_PER_YEAR+1 : DAYS_PER_YEAR)) { | ||||
|     long int yg = y + days / DAYS_PER_YEAR - (days % DAYS_PER_YEAR < 0); | ||||
|      | ||||
|     /* Adjust DAYS and Y to match the guessed year.  */ | ||||
|     days -= ((yg - y) * DAYS_PER_YEAR | ||||
| 	     + LEAPS_THRU_END_OF (yg - 1) | ||||
| 	     - LEAPS_THRU_END_OF (y - 1)); | ||||
|     y = yg; | ||||
|   } | ||||
|   dest->year = y; | ||||
|   ip = __mon_yday[__isleap(y)]; | ||||
|   for (y = 11; days < (long int) ip[y]; --y) | ||||
|     continue; | ||||
|   days -= ip[y]; | ||||
|   dest->month = y + 1; | ||||
|   dest->day   = days + 1; | ||||
|    | ||||
|   dest->centiseconds = ts.tv_nsec / 10000000; | ||||
|   dest->hundreds_of_microseconds = ( (ts.tv_nsec / 1000) | ||||
| 				     - (dest->centiseconds * 10000) ) / 100; | ||||
|   dest->microseconds = ( (ts.tv_nsec / 1000)  | ||||
| 			 - (dest->centiseconds * 10000) | ||||
| 			 - (dest->hundreds_of_microseconds * 100) ); | ||||
|   return dest; | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the modification time of the file. | ||||
|  */ | ||||
| time_t | ||||
| udf_get_modification_time(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     time_t ret_time; | ||||
|     long int usec; | ||||
|     udf_stamp_to_time(&ret_time, &usec, p_udf_dirent->fe.modification_time); | ||||
|     return ret_time; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the access time of the file. | ||||
|  */ | ||||
| time_t | ||||
| udf_get_access_time(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     time_t ret_time; | ||||
|     long int usec; | ||||
|     udf_stamp_to_time(&ret_time, &usec, p_udf_dirent->fe.access_time); | ||||
|     return ret_time; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
| /*!
 | ||||
|   Return the attribute (most recent create or access) time of the file | ||||
|  */ | ||||
| time_t | ||||
| udf_get_attribute_time(const udf_dirent_t *p_udf_dirent) | ||||
| { | ||||
|   if (p_udf_dirent) { | ||||
|     time_t ret_time; | ||||
|     long int usec; | ||||
|     udf_stamp_to_time(&ret_time, &usec, p_udf_dirent->fe.attribute_time); | ||||
|     return ret_time; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
| 
 | ||||
|  | @ -30,6 +30,10 @@ const char* additional_copyrights = | |||
| "http://www.freedos.org\r\n" | ||||
| "GNU General Public License (GPL) v2 or later, with binary redistribution allowed\r\n" | ||||
| "\r\n" | ||||
| "ISO extraction support from libcdio by Rocky Bernstein et al:\r\n" | ||||
| "http://www.gnu.org/software/libcdio\r\n" | ||||
| "GNU General Public License (GPL) v3 or later\r\n" | ||||
| "\r\n" | ||||
| "Syslinux support from Syslinux by H. Peter Anvin et al:\r\n" | ||||
| "http://www.syslinux.org\r\n" | ||||
| "GNU General Public License (GPL) v2 or later\r\n" | ||||
|  |  | |||
|  | @ -122,7 +122,7 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>../inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|  | @ -142,7 +142,7 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>../inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|  | @ -157,7 +157,7 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>../inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|  | @ -177,7 +177,7 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>../inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| /*
 | ||||
|  *  THIS SOFTWARE IS NOT COPYRIGHTED | ||||
|  * | ||||
|  *  Modified for libusb/MSVC: Pete Batard <pbatard@gmail.com> | ||||
|  *  Modified for libusb/MSVC: Pete Batard <pete@akeo.com> | ||||
|  * | ||||
|  *  This source code is offered for use in the public domain. You may | ||||
|  *  use, modify or distribute it freely. | ||||
|  | @ -29,8 +29,6 @@ | |||
| #define _INTTYPES_H_ | ||||
| 
 | ||||
| #include <stdint.h> | ||||
| /* SysLinux types addon */ | ||||
| #include <sltypes.h> | ||||
| 
 | ||||
| #ifdef	__cplusplus | ||||
| extern	"C"	{ | ||||
							
								
								
									
										34
									
								
								src/msvc-missing/unistd.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/msvc-missing/unistd.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| /**
 | ||||
|  * This file has no copyright assigned and is placed in the Public Domain. | ||||
|  * This file was originally part of the w64 mingw-runtime package. | ||||
|  */ | ||||
| 
 | ||||
| /* Workaround unistd.h for MS compilers */ | ||||
| 
 | ||||
| #ifndef _MSC_VER | ||||
| #error This header should only be used with Microsoft compilers | ||||
| #endif | ||||
| 
 | ||||
| #include <windows.h> | ||||
| 
 | ||||
| #ifndef _UNISTD_H_ | ||||
| #define _UNISTD_H_ | ||||
| 
 | ||||
| /* mode_t is used in the libcdio headers */ | ||||
| #ifndef _MODE_T_DEFINED | ||||
| #define _MODE_T_DEFINED | ||||
| typedef unsigned short mode_t; | ||||
| #endif /* _MODE_T_DEFINED */ | ||||
| 
 | ||||
| /* ssize_t is also not available (copy/paste from MinGW) */ | ||||
| #ifndef _SSIZE_T_DEFINED | ||||
| #define _SSIZE_T_DEFINED | ||||
| #undef ssize_t | ||||
| #ifdef _WIN64 | ||||
| typedef __int64 ssize_t; | ||||
| #else | ||||
| typedef int ssize_t; | ||||
| #endif /* _WIN64 */ | ||||
| #endif /* _SSIZE_T_DEFINED */ | ||||
| 
 | ||||
| #endif | ||||
|  | @ -52,6 +52,7 @@ | |||
| #define IDC_PROGRESS                    1012 | ||||
| #define IDC_DOSTYPE                     1013 | ||||
| #define IDC_NBPASSES                    1014 | ||||
| #define IDC_TEST                        1015 | ||||
| #define IDC_ABOUT_LICENSE               1030 | ||||
| #define IDC_ABOUT_ICON                  1031 | ||||
| #define IDC_RUFUS_BOLD                  1032 | ||||
|  |  | |||
|  | @ -1000,6 +1000,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | |||
| 		case IDC_ABOUT: | ||||
| 			CreateAboutBox(); | ||||
| 			break; | ||||
| 		case IDC_TEST: | ||||
| //			ExtractISO("D:\\Incoming\\GRMSDKX_EN_DVD.iso", NULL);
 | ||||
| //			ExtractISO("D:\\fd11src.iso", NULL);
 | ||||
| //			ExtractISO("D:\\Incoming\\en_windows_driver_kit_3790.iso", NULL);
 | ||||
| //			ExtractISO("D:\\Incoming\\en_windows_7_ultimate_with_sp1_x64_dvd_618240.iso", NULL);
 | ||||
| 			ExtractISO("D:\\Incoming\\Windows 8 Preview\\WindowsDeveloperPreview-64bit-English-Developer.iso", NULL); | ||||
| 			break; | ||||
| 		case IDC_DEVICE: | ||||
| 			switch (HIWORD(wParam)) { | ||||
| 			case CBN_SELCHANGE: | ||||
|  |  | |||
|  | @ -165,6 +165,7 @@ extern void DestroyTooltip(HWND hWnd); | |||
| extern void DestroyAllTooltips(void); | ||||
| extern BOOL Notification(int type, char* title, char* format, ...); | ||||
| extern BOOL ExtractDOS(const char* path); | ||||
| extern BOOL ExtractISO(const char* src_iso, const char* dest_dir); | ||||
| extern BOOL InstallSyslinux(DWORD num, const char* drive_name); | ||||
| extern void __cdecl FormatThread(void* param); | ||||
| extern BOOL CreatePartition(HANDLE hDrive); | ||||
|  |  | |||
							
								
								
									
										13
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 206, 278 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus v1.0.7.118" | ||||
| CAPTION "Rufus v1.0.7.119" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 | ||||
|  | @ -56,6 +56,7 @@ BEGIN | |||
|     CONTROL         "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9 | ||||
|     COMBOBOX        IDC_DOSTYPE,118,183,45,30,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ||||
|     COMBOBOX        IDC_NBPASSES,118,159,45,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||
|     PUSHBUTTON      "Test",IDC_TEST,62,236,20,14 | ||||
| END | ||||
| 
 | ||||
| IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | ||||
|  | @ -69,7 +70,7 @@ BEGIN | |||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||
|     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, | ||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||
|     LTEXT           "Version 1.0.7 (Build 118)",IDC_STATIC,46,19,78,8 | ||||
|     LTEXT           "Version 1.0.7 (Build 119)",IDC_STATIC,46,19,78,8 | ||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||
|  | @ -207,8 +208,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,0,7,118 | ||||
|  PRODUCTVERSION 1,0,7,118 | ||||
|  FILEVERSION 1,0,7,119 | ||||
|  PRODUCTVERSION 1,0,7,119 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -225,13 +226,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "akeo.ie" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.0.7.118" | ||||
|             VALUE "FileVersion", "1.0.7.119" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "1.0.7.118" | ||||
|             VALUE "ProductVersion", "1.0.7.119" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
|  | @ -96,8 +96,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -116,8 +116,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -131,8 +131,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -151,8 +151,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| TARGETNAME=libfat | ||||
| TARGETTYPE=LIBRARY | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.. | ||||
| C_DEFINES=$(C_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| INCLUDES=$(DDK_INC_PATH);..\..\msvc-missing | ||||
| C_DEFINES=$(C_DEFINES) /Dinline=__inline /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
| MSC_WARNING_LEVEL=/W3 | ||||
|  |  | |||
|  | @ -94,8 +94,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -114,8 +114,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -129,8 +129,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  | @ -149,8 +149,8 @@ | |||
|       </PrecompiledHeader> | ||||
|       <Optimization>MaxSpeed</Optimization> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;ISOLATION_AWARE_ENABLED;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <PreprocessorDefinitions>inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <AdditionalIncludeDirectories>..;..\..\..\msvc-missing;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||||
|       <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| TARGETNAME=libinstaller | ||||
| TARGETTYPE=LIBRARY | ||||
| 
 | ||||
| INCLUDES=$(DDK_INC_PATH);.. | ||||
| C_DEFINES=$(C_DEFINES) /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| INCLUDES=$(DDK_INC_PATH);..\..\msvc-missing | ||||
| C_DEFINES=$(C_DEFINES) /Dinline=__inline /DDDKBUILD /DUNICODE /D_UNICODE /DISOLATION_AWARE_ENABLED | ||||
| 
 | ||||
| !IFNDEF MSC_WARNING_LEVEL | ||||
| MSC_WARNING_LEVEL=/W3 | ||||
|  |  | |||
|  | @ -55,6 +55,51 @@ copy obj%BUILD_ALT_DIR%\%ARCH_DIR%\libinstaller.lib . >NUL 2>&1 | |||
| if EXIST Makefile.hide ren Makefile.hide Makefile | ||||
| if EXIST sources del sources >NUL 2>&1 | ||||
| 
 | ||||
| ::# libcdio iso9660 Library | ||||
| cd ..\..\libcdio\iso9660 | ||||
| if EXIST Makefile ren Makefile Makefile.hide | ||||
| 
 | ||||
| copy .msvc\iso9660_sources sources >NUL 2>&1 | ||||
| 
 | ||||
| @echo on | ||||
| %BUILD_CMD% | ||||
| @echo off | ||||
| if errorlevel 1 goto builderror | ||||
| copy obj%BUILD_ALT_DIR%\%ARCH_DIR%\iso9660.lib . >NUL 2>&1 | ||||
| 
 | ||||
| if EXIST Makefile.hide ren Makefile.hide Makefile | ||||
| if EXIST sources del sources >NUL 2>&1 | ||||
| 
 | ||||
| ::# libcdio udf Library | ||||
| cd ..\udf | ||||
| if EXIST Makefile ren Makefile Makefile.hide | ||||
| 
 | ||||
| copy .msvc\udf_sources sources >NUL 2>&1 | ||||
| 
 | ||||
| @echo on | ||||
| %BUILD_CMD% | ||||
| @echo off | ||||
| if errorlevel 1 goto builderror | ||||
| copy obj%BUILD_ALT_DIR%\%ARCH_DIR%\udf.lib . >NUL 2>&1 | ||||
| 
 | ||||
| if EXIST Makefile.hide ren Makefile.hide Makefile | ||||
| if EXIST sources del sources >NUL 2>&1 | ||||
| 
 | ||||
| ::# libcdio driver Library | ||||
| cd ..\driver | ||||
| if EXIST Makefile ren Makefile Makefile.hide | ||||
| 
 | ||||
| copy .msvc\driver_sources sources >NUL 2>&1 | ||||
| 
 | ||||
| @echo on | ||||
| %BUILD_CMD% | ||||
| @echo off | ||||
| if errorlevel 1 goto builderror | ||||
| copy obj%BUILD_ALT_DIR%\%ARCH_DIR%\driver.lib . >NUL 2>&1 | ||||
| 
 | ||||
| if EXIST Makefile.hide ren Makefile.hide Makefile | ||||
| if EXIST sources del sources >NUL 2>&1 | ||||
| 
 | ||||
| ::# Rufus Application | ||||
| cd ..\.. | ||||
| if EXIST Makefile ren Makefile Makefile.hide | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue