Skip to content

Commit

Permalink
build under centos 8 and ubuntu 20 (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
scholarsmate authored Dec 27, 2021
1 parent 3833214 commit ad4fc7a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
27 changes: 27 additions & 0 deletions docker/Dockerfile.centos8-cpp-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# CLion remote docker environment (How to build docker container, run and stop it)
#
# Build:
# docker build -t build/centos-8/cpp-env:1.0 -f Dockerfile.centos8-cpp-env .

FROM centos:8

RUN yum -y update && yum -y install dnf-plugins-core && yum config-manager --set-enabled powertools && yum -y install \
openssh-server \
make \
autoconf \
automake \
dos2unix \
gcc \
gcc-c++ \
gdb \
clang \
cmake \
rsync \
tar \
python39 \
doxygen \
graphviz \
swig \
ninja-build \
wget \
&& yum clean all
28 changes: 28 additions & 0 deletions docker/Dockerfile.ubuntu20-cpp-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build and run:
# docker build -t build/ubuntu-20.04/cpp-env:1.0 -f Dockerfile.ubuntu20-cpp-env .

FROM ubuntu:20.04

RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata
RUN apt-get update && apt-get -y install \
build-essential \
gcc \
g++ \
gdb \
clang \
make \
ninja-build \
cmake \
autoconf \
automake \
locales-all \
dos2unix \
rsync \
tar \
python \
python-dev \
doxygen \
graphviz \
swig \
wget \
&& apt-get clean
4 changes: 2 additions & 2 deletions src/omega_edit/src/encodings.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ size_t omega_bin2hex(const omega_byte_t *src, char *dst, size_t src_length) {
assert(src);
assert(dst);
static const char HEX_CONVERSION_TABLE[] = "0123456789abcdef";
size_t j = 0;
size_t i, j = 0;

for (size_t i = 0; i < src_length; ++i) {
for (i = 0; i < src_length; ++i) {
dst[j++] = HEX_CONVERSION_TABLE[src[i] >> 4];
dst[j++] = HEX_CONVERSION_TABLE[src[i] & 15];
}
Expand Down
1 change: 1 addition & 0 deletions src/omega_edit/src/impl_/session_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "../../include/edit.h"
#include "../../include/fwd_defs.h"
#include "internal_fwd_defs.hpp"
#include "model_def.hpp"
#include <cstdio>
#include <string>
#include <vector>
Expand Down
9 changes: 6 additions & 3 deletions src/omega_edit/src/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ int omega_util_file_exists(const char *file_name) {

void omega_util_byte_transformer(omega_byte_t *buffer, int64_t len, omega_util_byte_transform_t transform) {
assert(buffer);
for (int64_t i = 0; i < len; ++i) { buffer[i] = transform(buffer[i]); }
int64_t i;
for (i = 0; i < len; ++i) { buffer[i] = transform(buffer[i]); }
}

int omega_util_left_shift_buffer(omega_byte_t *buffer, int64_t len, omega_byte_t shift_left) {
Expand All @@ -49,7 +50,8 @@ int omega_util_left_shift_buffer(omega_byte_t *buffer, int64_t len, omega_byte_t
omega_byte_t shift_right = 8 - shift_left;
omega_byte_t mask = ((1 << shift_left) - 1) << shift_right;
omega_byte_t bits1 = 0;
for (int64_t i = len - 1; i >= 0; --i) {
int64_t i;
for (i = len - 1; i >= 0; --i) {
const unsigned char bits2 = buffer[i] & mask;
buffer[i] <<= shift_left;
buffer[i] |= bits1 >> shift_right;
Expand All @@ -66,7 +68,8 @@ int omega_util_right_shift_buffer(omega_byte_t *buffer, int64_t len, omega_byte_
omega_byte_t shift_left = 8 - shift_right;
omega_byte_t mask = (1 << shift_right) - 1;
omega_byte_t bits1 = 0;
for (int64_t i = len - 1; i >= 0; --i) {
int64_t i;
for (i = len - 1; i >= 0; --i) {
const unsigned char bits2 = buffer[i] & mask;
buffer[i] >>= shift_right;
buffer[i] |= bits1 << shift_left;
Expand Down

0 comments on commit ad4fc7a

Please sign in to comment.