Fix some build warnings.

This commit is contained in:
Eugene Wang 2023-04-05 07:53:10 -04:00
parent 9d0770a2ef
commit 5fa6edab28
13 changed files with 27 additions and 38 deletions

View File

@ -27,7 +27,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTwain-temp", "src\NTwain-t
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForm32", "samples\WinForm32\WinForm32.csproj", "{7792A94E-D0B4-440D-8BD5-CA1CA548782C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForm32", "samples\WinForm32\WinForm32.csproj", "{7792A94E-D0B4-440D-8BD5-CA1CA548782C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinForm64", "samples\WinForm64\WinForm64.csproj", "{C9666CB2-C9A6-48C8-AB51-D616A48058A7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForm64", "samples\WinForm64\WinForm64.csproj", "{C9666CB2-C9A6-48C8-AB51-D616A48058A7}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -41,7 +41,6 @@ Global
{3C8A3CF9-A60D-4F21-B866-D291A7AABD4A}.Release|Any CPU.Build.0 = Release|Any CPU {3C8A3CF9-A60D-4F21-B866-D291A7AABD4A}.Release|Any CPU.Build.0 = Release|Any CPU
{A7020B90-5CE4-43EF-A75D-5E1F9B501CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7020B90-5CE4-43EF-A75D-5E1F9B501CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7020B90-5CE4-43EF-A75D-5E1F9B501CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU {A7020B90-5CE4-43EF-A75D-5E1F9B501CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7020B90-5CE4-43EF-A75D-5E1F9B501CAC}.Release|Any CPU.Build.0 = Release|Any CPU
{7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Debug|Any CPU.Build.0 = Debug|Any CPU {7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Release|Any CPU.ActiveCfg = Release|Any CPU {7792A94E-D0B4-440D-8BD5-CA1CA548782C}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -240,6 +240,7 @@ namespace NTwain.Data
/// Set our value... /// Set our value...
/// </summary> /// </summary>
/// <param name="a_sz"></param> /// <param name="a_sz"></param>
/// <param name="a_blMayHavePrefix"></param>
private void SetValue(string a_sz, bool a_blMayHavePrefix) private void SetValue(string a_sz, bool a_blMayHavePrefix)
{ {
// If we're running on a Mac, tack on the prefix 'byte'... // If we're running on a Mac, tack on the prefix 'byte'...
@ -415,6 +416,7 @@ namespace NTwain.Data
/// Set our value... /// Set our value...
/// </summary> /// </summary>
/// <param name="a_sz"></param> /// <param name="a_sz"></param>
/// <param name="a_blMayHavePrefix"></param>
private void SetValue(string a_sz, bool a_blMayHavePrefix) private void SetValue(string a_sz, bool a_blMayHavePrefix)
{ {
// If we're running on a Mac, tack on the prefix 'byte'... // If we're running on a Mac, tack on the prefix 'byte'...
@ -629,6 +631,7 @@ namespace NTwain.Data
/// Set our value... /// Set our value...
/// </summary> /// </summary>
/// <param name="a_sz"></param> /// <param name="a_sz"></param>
/// <param name="a_blMayHavePrefix"></param>
private void SetValue(string a_sz, bool a_blMayHavePrefix) private void SetValue(string a_sz, bool a_blMayHavePrefix)
{ {
// If we're running on a Mac, tack on the prefix 'byte'... // If we're running on a Mac, tack on the prefix 'byte'...
@ -923,6 +926,7 @@ namespace NTwain.Data
/// Set our value... /// Set our value...
/// </summary> /// </summary>
/// <param name="a_sz"></param> /// <param name="a_sz"></param>
/// <param name="a_blMayHavePrefix"></param>
private void SetValue(string a_sz, bool a_blMayHavePrefix) private void SetValue(string a_sz, bool a_blMayHavePrefix)
{ {
// If we're running on a Mac, tack on the prefix 'byte'... // If we're running on a Mac, tack on the prefix 'byte'...

View File

@ -15,6 +15,7 @@ namespace NTwain.Data
/// <summary> /// <summary>
/// Reads pointer as UTF8 string. /// Reads pointer as UTF8 string.
/// </summary> /// </summary>
/// <param name="memMgr"></param>
/// <param name="data">Pointer to string.</param> /// <param name="data">Pointer to string.</param>
/// <param name="length">Number of bytes to read.</param> /// <param name="length">Number of bytes to read.</param>
/// <returns></returns> /// <returns></returns>

View File

@ -21,7 +21,7 @@ namespace NTwain
/// Initializes a new instance of the <see cref="TransferErrorEventArgs"/> class. /// Initializes a new instance of the <see cref="TransferErrorEventArgs"/> class.
/// </summary> /// </summary>
/// <param name="code">The code.</param> /// <param name="code">The code.</param>
/// <param name="status">Additional status info from TWAIN.</param> /// <param name="info">Additional status info from TWAIN.</param>
public TransferErrorEventArgs(STS code, string? info) public TransferErrorEventArgs(STS code, string? info)
{ {
Code = code; Code = code;

View File

@ -8,11 +8,6 @@ namespace NTwain.Triplets.ControlDATs
/// </summary> /// </summary>
public class DeviceEvent public class DeviceEvent
{ {
/// <summary>
/// Gets the device event detail.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public TWRC Get(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out TW_DEVICEEVENT data) public TWRC Get(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out TW_DEVICEEVENT data)
{ {
data = default; data = default;

View File

@ -19,6 +19,8 @@ namespace NTwain.Triplets.ControlDATs
/// Opens the TWAIN data source selector dialog /// Opens the TWAIN data source selector dialog
/// to choose the default data source. /// to choose the default data source.
/// </summary> /// </summary>
/// <param name="app"></param>
/// <param name="ds"></param>
/// <returns></returns> /// <returns></returns>
public TWRC UserSelect(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds) public TWRC UserSelect(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds)
{ {
@ -35,6 +37,7 @@ namespace NTwain.Triplets.ControlDATs
/// <summary> /// <summary>
/// Sets the default data source. /// Sets the default data source.
/// </summary> /// </summary>
/// <param name="app"></param>
/// <param name="ds"></param> /// <param name="ds"></param>
/// <returns></returns> /// <returns></returns>
public TWRC Set(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds) public TWRC Set(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds)
@ -44,6 +47,7 @@ namespace NTwain.Triplets.ControlDATs
/// Gets the first available data source in an enumerating fashion /// Gets the first available data source in an enumerating fashion
/// (use <see cref="GetNext"/> for subsequent ones). /// (use <see cref="GetNext"/> for subsequent ones).
/// </summary> /// </summary>
/// <param name="app"></param>
/// <param name="ds"></param> /// <param name="ds"></param>
/// <returns></returns> /// <returns></returns>
public TWRC GetFirst(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds) public TWRC GetFirst(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds)
@ -54,8 +58,9 @@ namespace NTwain.Triplets.ControlDATs
/// <summary> /// <summary>
/// Gets the next available data source in an enumerating fashion (after using <see cref="GetFirst"/>). /// Gets the next available data source in an enumerating fashion (after using <see cref="GetFirst"/>).
/// Ends when return values is <see cref="STS.ENDOFLIST"/>. /// Ends when return values is <see cref="TWRC.ENDOFLIST"/>.
/// </summary> /// </summary>
/// <param name="app"></param>
/// <param name="ds"></param> /// <param name="ds"></param>
/// <returns></returns> /// <returns></returns>
public TWRC GetNext(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds) public TWRC GetNext(ref TW_IDENTITY_LEGACY app, out TW_IDENTITY_LEGACY ds)

View File

@ -9,11 +9,6 @@ namespace NTwain.Triplets.ControlDATs
/// </summary> /// </summary>
public class Status public class Status
{ {
/// <summary>
/// Gets the current status for the DSM.
/// </summary>
/// <param name="status"></param>
/// <returns></returns>
public TWRC GetForDSM(ref TW_IDENTITY_LEGACY app, out TW_STATUS status) public TWRC GetForDSM(ref TW_IDENTITY_LEGACY app, out TW_STATUS status)
{ {
status = default; status = default;
@ -44,11 +39,6 @@ namespace NTwain.Triplets.ControlDATs
return rc; return rc;
} }
/// <summary>
/// Gets the status for the current source.
/// </summary>
/// <param name="status"></param>
/// <returns></returns>
public TWRC GetForDS(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out TW_STATUS status) public TWRC GetForDS(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out TW_STATUS status)
{ {
status = default; status = default;

View File

@ -11,10 +11,11 @@ namespace NTwain.Triplets.ControlDATs
{ {
/// <summary> /// <summary>
/// Gets the extended text info for a previously received <see cref="TW_STATUS"/>. /// Gets the extended text info for a previously received <see cref="TW_STATUS"/>.
/// If this is called you should try to extract the string value from it once /// If this is called you should try to extract the string value from it
/// with <see cref="TW_STATUSUTF8.ReadAndFree"/> or call <see cref="TW_STATUSUTF8.Free"/> /// with <see cref="TW_STATUSUTF8.Read(IMemoryManager, bool)"/> or call <see cref="TW_STATUSUTF8.Free"/>
/// so there's no memory leak. /// so there's no memory leak.
/// </summary> /// </summary>
/// <param name="app"></param>
/// <param name="status"></param> /// <param name="status"></param>
/// <param name="extendedStatus"></param> /// <param name="extendedStatus"></param>
/// <returns></returns> /// <returns></returns>

View File

@ -8,22 +8,12 @@ namespace NTwain.Triplets.ControlDATs
/// </summary> /// </summary>
public class XferGroup public class XferGroup
{ {
/// <summary>
/// Gets the transfer group used.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public TWRC Get(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out DG data) public TWRC Get(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, out DG data)
{ {
data = default; data = default;
return DoIt(ref app, ref ds, MSG.GET, ref data); return DoIt(ref app, ref ds, MSG.GET, ref data);
} }
/// <summary>
/// Sets the transfer group to be used.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public TWRC Set(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, DG data) public TWRC Set(ref TW_IDENTITY_LEGACY app, ref TW_IDENTITY_LEGACY ds, DG data)
{ {
return DoIt(ref app, ref ds, MSG.SET, ref data); return DoIt(ref app, ref ds, MSG.SET, ref data);

View File

@ -1,4 +1,5 @@
using NTwain.Triplets.AudioDATs; using NTwain.Data;
using NTwain.Triplets.AudioDATs;
namespace NTwain.Triplets namespace NTwain.Triplets
{ {

View File

@ -1,4 +1,5 @@
using NTwain.Triplets.ControlDATs; using NTwain.Data;
using NTwain.Triplets.ControlDATs;
namespace NTwain.Triplets namespace NTwain.Triplets
{ {

View File

@ -83,7 +83,7 @@ namespace NTwain
/// Gets a CAP's help text (description). /// Gets a CAP's help text (description).
/// </summary> /// </summary>
/// <param name="cap"></param> /// <param name="cap"></param>
/// <param name="value"></param> /// <param name="help"></param>
/// <returns></returns> /// <returns></returns>
public STS GetCapHelp(CAP cap, out string? help) public STS GetCapHelp(CAP cap, out string? help)
{ {
@ -98,7 +98,7 @@ namespace NTwain
/// Gets a CAP's text name label. /// Gets a CAP's text name label.
/// </summary> /// </summary>
/// <param name="cap"></param> /// <param name="cap"></param>
/// <param name="value"></param> /// <param name="label"></param>
/// <returns></returns> /// <returns></returns>
public STS GetCapLabel(CAP cap, out string? label) public STS GetCapLabel(CAP cap, out string? label)
{ {
@ -113,7 +113,7 @@ namespace NTwain
/// Gets a CAP's value label texts. /// Gets a CAP's value label texts.
/// </summary> /// </summary>
/// <param name="cap"></param> /// <param name="cap"></param>
/// <param name="value"></param> /// <param name="labels"></param>
/// <returns></returns> /// <returns></returns>
public STS GetCapLabelEnum(CAP cap, out string[]? labels) public STS GetCapLabelEnum(CAP cap, out string[]? labels)
{ {
@ -127,7 +127,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Sets a CAP's current value. /// Sets a CAP's current value.
/// </summary> /// </summary>
/// <param name="cap"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public STS SetCap(ref TW_CAPABILITY value) public STS SetCap(ref TW_CAPABILITY value)
{ {
@ -139,7 +139,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Sets a CAP's constraint values. /// Sets a CAP's constraint values.
/// </summary> /// </summary>
/// <param name="cap"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public STS SetConstraint(ref TW_CAPABILITY value) public STS SetConstraint(ref TW_CAPABILITY value)
{ {

View File

@ -110,7 +110,9 @@ namespace NTwain
{ {
IsBackground = true IsBackground = true
}; };
#if WINDOWS || NETFRAMEWORK
t.SetApartmentState(ApartmentState.STA); // just in case t.SetApartmentState(ApartmentState.STA); // just in case
#endif
t.Start(); t.Start();
} }