[Spice-devel] [PATCH 8B/15] Remove glz_encoder_config.h

Jonathon Jongsma jjongsma at redhat.com
Thu Dec 3 11:51:35 PST 2015


Move all code from glz_encoder_config.h into other files.
---

This is a commit that was split out from 08/15

 server/Makefile.am          |  1 -
 server/dcc-encoders.h       |  1 -
 server/glz-encoder-dict.c   |  1 +
 server/glz-encoder-dict.h   |  4 ++-
 server/glz-encoder-priv.h   | 12 +++++++++
 server/glz-encoder.h        | 20 ++++++++++++++-
 server/glz_encoder_config.h | 59 ---------------------------------------------
 7 files changed, 35 insertions(+), 63 deletions(-)
 delete mode 100644 server/glz_encoder_config.h

diff --git a/server/Makefile.am b/server/Makefile.am
index 2bb4fec..32ab8eb 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -71,7 +71,6 @@ libspice_server_la_SOURCES =			\
 	demarshallers.h				\
 	glz-encoder.c				\
 	glz-encoder.h				\
-	glz_encoder_config.h			\
 	glz-encoder-dict.c		\
 	glz-encoder-dict.h		\
 	glz-encoder-priv.h	\
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 8f61b52..4e9b66a 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -24,7 +24,6 @@
 #include "red-channel.h"
 #include "red-parse-qxl.h"
 #include "image-cache.h"
-#include "glz-encoder-dict.h"
 #include "glz-encoder.h"
 #include "jpeg-encoder.h"
 #ifdef USE_LZ4
diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
index 1fd6753..af74736 100644
--- a/server/glz-encoder-dict.c
+++ b/server/glz-encoder-dict.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "glz-encoder.h"
 #include "glz-encoder-dict.h"
 #include "glz-encoder-priv.h"
 
diff --git a/server/glz-encoder-dict.h b/server/glz-encoder-dict.h
index 960f165..79b3781 100644
--- a/server/glz-encoder-dict.h
+++ b/server/glz-encoder-dict.h
@@ -19,7 +19,6 @@
 #define GLZ_ENCODER_DICT_H_
 
 #include <stdint.h>
-#include "glz_encoder_config.h"
 
 /*
     Interface for maintaining lz dictionary that is shared among several encoders.
@@ -30,6 +29,9 @@
 typedef void GlzEncDictContext;
 typedef void GlzEncDictImageContext;
 
+typedef void GlzUsrImageContext;
+typedef struct GlzEncoderUsrContext GlzEncoderUsrContext;
+
 /* NOTE: DISPLAY_MIGRATE_DATA_VERSION should change in case GlzEncDictRestoreData changes*/
 typedef struct GlzEncDictRestoreData {
     uint32_t size;
diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h
index a408966..3f22508 100644
--- a/server/glz-encoder-priv.h
+++ b/server/glz-encoder-priv.h
@@ -183,4 +183,16 @@ void glz_dictionary_post_encode(uint32_t encoder_id, GlzEncoderUsrContext *usr,
         (dict)->window.encoders_heads[enc_id]].pixels_so_far <= \
         ref_seg->pixels_so_far)))
 
+#ifdef DEBUG
+
+#define GLZ_ASSERT(usr, x)                                              \
+    if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x);
+
+#else
+
+#define GLZ_ASSERT(usr, x)
+
+#endif
+
+
 #endif // GLZ_ENCODER_PRIV_H_
diff --git a/server/glz-encoder.h b/server/glz-encoder.h
index 93164ed..dc08830 100644
--- a/server/glz-encoder.h
+++ b/server/glz-encoder.h
@@ -23,7 +23,25 @@
 #include <stdint.h>
 #include "common/lz_common.h"
 #include "glz-encoder-dict.h"
-#include "glz_encoder_config.h"
+
+struct GlzEncoderUsrContext {
+    SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+    void    *(*malloc)(GlzEncoderUsrContext *usr, int size);
+    void (*free)(GlzEncoderUsrContext *usr, void *ptr);
+
+    // get the next chunk of the image which is entered to the dictionary. If the image is down to
+    // top, return it from the last line to the first one (stride should always be positive)
+    int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines);
+
+    // get the next chunk of the compressed buffer.return number of bytes in the chunk.
+    int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr);
+
+    // called when an image is removed from the dictionary, due to the window size limit
+    void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image);
+
+};
 
 typedef void GlzEncoderContext;
 
diff --git a/server/glz_encoder_config.h b/server/glz_encoder_config.h
deleted file mode 100644
index 6472668..0000000
--- a/server/glz_encoder_config.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-   Copyright (C) 2009 Red Hat, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _H_GLZ_ENCODER_CONFIG
-#define _H_GLZ_ENCODER_CONFIG
-
-#include <spice/macros.h>
-#include "common/lz_common.h"
-
-typedef void GlzUsrImageContext;
-typedef struct GlzEncoderUsrContext GlzEncoderUsrContext;
-
-struct GlzEncoderUsrContext {
-    SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...);
-    SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...);
-    SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...);
-    void    *(*malloc)(GlzEncoderUsrContext *usr, int size);
-    void (*free)(GlzEncoderUsrContext *usr, void *ptr);
-
-    // get the next chunk of the image which is entered to the dictionary. If the image is down to
-    // top, return it from the last line to the first one (stride should always be positive)
-    int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines);
-
-    // get the next chunk of the compressed buffer.return number of bytes in the chunk.
-    int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr);
-
-    // called when an image is removed from the dictionary, due to the window size limit
-    void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image);
-
-};
-
-
-#ifdef DEBUG
-
-#define GLZ_ASSERT(usr, x) \
-    if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x);
-
-#else
-
-#define GLZ_ASSERT(usr, x)
-
-#endif
-
-
-#endif
-- 
2.4.3



More information about the Spice-devel mailing list