moved zbuff source files into lib/deprecated
diff --git a/lib/Makefile b/lib/Makefile
index 8f316aa..bf1088d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -23,24 +23,22 @@
 LIBDIR ?= $(PREFIX)/lib
 INCLUDEDIR=$(PREFIX)/include
 
-CPPFLAGS= -I. -I./common -DXXH_NAMESPACE=XXH_
-CFLAGS ?= -O3
-CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \
-          -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef \
-          -Wpointer-arith
-FLAGS   = $(CPPFLAGS) $(CFLAGS) $(MOREFLAGS)
+CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
+CFLAGS  ?= -O3
+CFLAGS  += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 \
+           -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef \
+           -Wpointer-arith
+CFLAGS  += $(MOREFLAGS)
+FLAGS    = $(CPPFLAGS) $(CFLAGS)
 
 
-ZSTD_FILES := $(wildcard common/*.c compress/*.c decompress/*.c dictBuilder/*.c)
-ZSTD_EXCLUDE := compress/zbuff_compress.c decompress/zbuff_decompress.c
-ZSTD_FILES := $(filter-out $(ZSTD_EXCLUDE), $(ZSTD_FILES))
-
+ZSTD_FILES := $(wildcard common/*.c compress/*.c decompress/*.c dictBuilder/*.c deprecated/*.c)
 
 ifeq ($(ZSTD_LEGACY_SUPPORT), 0)
 CPPFLAGS  += -DZSTD_LEGACY_SUPPORT=0
 else
-ZSTD_FILES+= legacy/*.c
 CPPFLAGS  += -I./legacy -DZSTD_LEGACY_SUPPORT=1
+ZSTD_FILES+= $(wildcard legacy/*.c)
 endif
 
 # OS X linker doesn't support -soname, and use different extension
@@ -90,8 +88,8 @@
 lib: libzstd.a libzstd
 
 clean:
-	@$(RM) -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc dll/libzstd.dll dll/libzstd.lib
-	@$(RM) -f decompress/*.o
+	@$(RM) core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc dll/libzstd.dll dll/libzstd.lib
+	@$(RM) decompress/*.o
 	@echo Cleaning library completed
 
 #------------------------------------------------------------------------
@@ -116,7 +114,7 @@
 	@install -m 644 libzstd.a $(DESTDIR)$(LIBDIR)/libzstd.a
 	@install -m 644 zstd.h $(DESTDIR)$(INCLUDEDIR)/zstd.h
 	@install -m 644 common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)/zstd_errors.h
-	@install -m 644 common/zbuff.h $(DESTDIR)$(INCLUDEDIR)/zbuff.h
+	@install -m 644 deprecated/zbuff.h $(DESTDIR)$(INCLUDEDIR)/zbuff.h   # prototypes generate deprecation warnings
 	@install -m 644 dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)/zdict.h
 	@echo zstd static and shared library installed
 
diff --git a/lib/README.md b/lib/README.md
index d33ad52..3357e3d 100644
--- a/lib/README.md
+++ b/lib/README.md
@@ -56,15 +56,15 @@
 ```
     gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\libzstd.dll
 ```
-The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`. 
+The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
 
 
 #### Obsolete streaming API
 
 Streaming is now provided within `zstd.h`.
-Older streaming API is still available within `common/zbuff.h`.
-It is now deprecated, and will be removed in a future version.
-Consider migrating towards newer streaming API in `zstd.h`.
+Older streaming API is still available within `deprecated/zbuff.h`.
+It will be removed in a future version.
+Consider migrating code towards newer streaming API in `zstd.h`.
 
 
 #### Miscellaneous
diff --git a/lib/common/zstd_common.c b/lib/common/zstd_common.c
index 54bc91c..f30128c 100644
--- a/lib/common/zstd_common.c
+++ b/lib/common/zstd_common.c
@@ -16,7 +16,6 @@
 #include "error_private.h"
 #define ZSTD_STATIC_LINKING_ONLY
 #include "zstd.h"           /* declaration of ZSTD_isError, ZSTD_getErrorName, ZSTD_getErrorCode, ZSTD_getErrorString, ZSTD_versionNumber */
-#include "zbuff.h"          /* declaration of ZBUFF_isError, ZBUFF_getErrorName */
 
 
 /*-****************************************
@@ -44,16 +43,11 @@
 *   provides error code string from enum */
 const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorName(code); }
 
-
-/* **************************************************************
-*  ZBUFF Error Management
-****************************************************************/
+/* ---   ZBUFF Error Management  (deprecated)   --- */
 unsigned ZBUFF_isError(size_t errorCode) { return ERR_isError(errorCode); }
-
 const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); }
 
 
-
 /*=**************************************************************
 *  Custom allocator
 ****************************************************************/
diff --git a/lib/common/zbuff.h b/lib/deprecated/zbuff.h
similarity index 99%
rename from lib/common/zbuff.h
rename to lib/deprecated/zbuff.h
index e8af504..8e55c39 100644
--- a/lib/common/zbuff.h
+++ b/lib/deprecated/zbuff.h
@@ -202,6 +202,7 @@
                                                const void* dict, size_t dictSize,
                                                ZSTD_parameters params, unsigned long long pledgedSrcSize);
 
+
 #endif /* ZBUFF_STATIC_LINKING_ONLY */
 
 
diff --git a/lib/compress/zbuff_compress.c b/lib/deprecated/zbuff_compress.c
similarity index 100%
rename from lib/compress/zbuff_compress.c
rename to lib/deprecated/zbuff_compress.c
diff --git a/lib/decompress/zbuff_decompress.c b/lib/deprecated/zbuff_decompress.c
similarity index 100%
rename from lib/decompress/zbuff_decompress.c
rename to lib/deprecated/zbuff_decompress.c
diff --git a/lib/zstd.h b/lib/zstd.h
index a1b0e62..a10a9ea 100644
--- a/lib/zstd.h
+++ b/lib/zstd.h
@@ -53,8 +53,6 @@
 *********************************************************************************************************/
 
 /*------   Version   ------*/
-ZSTDLIB_API unsigned ZSTD_versionNumber (void);  /**< returns version number of ZSTD */
-
 #define ZSTD_VERSION_MAJOR    1
 #define ZSTD_VERSION_MINOR    1
 #define ZSTD_VERSION_RELEASE  2
@@ -65,6 +63,7 @@
 #define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
 
 #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
+ZSTDLIB_API unsigned ZSTD_versionNumber (void);
 
 
 /***************************************