[phodav,09/13] spice-win: remove MapDriveEnum

Submitted by Jakub Janků on May 23, 2019, 8:37 a.m.

Details

Message ID 20190523083725.1554-10-jjanku@redhat.com
State New
Headers show
Series "Miscellaneous series" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Jakub Janků May 23, 2019, 8:37 a.m.
The enum doesn't add much value, let's remove it.

Signed-off-by: Jakub Janků <jjanku@redhat.com>
---
 spice/spice-webdavd.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index c77c870..29058e7 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -738,12 +738,6 @@  open_mux_path (const char *path)
 #ifdef G_OS_WIN32
 #define MAX_SHARED_FOLDER_NAME_SIZE 64
 #define MAX_DRIVE_LETTER_SIZE 3
-typedef enum _MapDriveEnum
-{
-  MAP_DRIVE_OK,
-  MAP_DRIVE_TRY_AGAIN,
-  MAP_DRIVE_ERROR
-} MapDriveEnum;
 
 typedef struct _MapDriveData
 {
@@ -828,7 +822,7 @@  netresource_free(NETRESOURCE *net_resource)
   g_free(net_resource->lpRemoteName);
 }
 
-static MapDriveEnum
+static guint32
 map_drive(const gchar drive_letter)
 {
   NETRESOURCE net_resource;
@@ -841,16 +835,17 @@  map_drive(const gchar drive_letter)
   if (errn == NO_ERROR)
     {
       g_debug ("Shared folder mapped to %c succesfully", drive_letter);
-      return MAP_DRIVE_OK;
     }
   else if (errn == ERROR_ALREADY_ASSIGNED)
     {
       g_debug ("Drive letter %c is already assigned", drive_letter);
-      return MAP_DRIVE_TRY_AGAIN;
+    }
+  else
+    {
+      g_warning ("map_drive error %d", errn);
     }
 
-  g_warning ("map_drive error %d", errn);
-  return MAP_DRIVE_ERROR;
+  return errn;
 }
 
 static void
@@ -915,7 +910,7 @@  map_drive_cb(GTask *task,
           break;
         }
 
-      if (map_drive (drive_letter) != MAP_DRIVE_TRY_AGAIN)
+      if (map_drive (drive_letter) != ERROR_ALREADY_ASSIGNED)
         {
           break;
         }

Comments

On Thu, May 23, 2019 at 10:37 AM Jakub Janků <jjanku@redhat.com> wrote:
>
> The enum doesn't add much value, let's remove it.
>
> Signed-off-by: Jakub Janků <jjanku@redhat.com>

ack

> ---
>  spice/spice-webdavd.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
> index c77c870..29058e7 100644
> --- a/spice/spice-webdavd.c
> +++ b/spice/spice-webdavd.c
> @@ -738,12 +738,6 @@ open_mux_path (const char *path)
>  #ifdef G_OS_WIN32
>  #define MAX_SHARED_FOLDER_NAME_SIZE 64
>  #define MAX_DRIVE_LETTER_SIZE 3
> -typedef enum _MapDriveEnum
> -{
> -  MAP_DRIVE_OK,
> -  MAP_DRIVE_TRY_AGAIN,
> -  MAP_DRIVE_ERROR
> -} MapDriveEnum;
>
>  typedef struct _MapDriveData
>  {
> @@ -828,7 +822,7 @@ netresource_free(NETRESOURCE *net_resource)
>    g_free(net_resource->lpRemoteName);
>  }
>
> -static MapDriveEnum
> +static guint32
>  map_drive(const gchar drive_letter)
>  {
>    NETRESOURCE net_resource;
> @@ -841,16 +835,17 @@ map_drive(const gchar drive_letter)
>    if (errn == NO_ERROR)
>      {
>        g_debug ("Shared folder mapped to %c succesfully", drive_letter);
> -      return MAP_DRIVE_OK;
>      }
>    else if (errn == ERROR_ALREADY_ASSIGNED)
>      {
>        g_debug ("Drive letter %c is already assigned", drive_letter);
> -      return MAP_DRIVE_TRY_AGAIN;
> +    }
> +  else
> +    {
> +      g_warning ("map_drive error %d", errn);
>      }
>
> -  g_warning ("map_drive error %d", errn);
> -  return MAP_DRIVE_ERROR;
> +  return errn;
>  }
>
>  static void
> @@ -915,7 +910,7 @@ map_drive_cb(GTask *task,
>            break;
>          }
>
> -      if (map_drive (drive_letter) != MAP_DRIVE_TRY_AGAIN)
> +      if (map_drive (drive_letter) != ERROR_ALREADY_ASSIGNED)
>          {
>            break;
>          }
> --
> 2.21.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel