Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Микрофиксы #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions KPHP/compiler/bicycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with VK/KittenPHP-DB-Engine. If not, see <http://www.gnu.org/licenses/>.

This program is released under the GPL with the additional exemption
This program is released under the GPL with the additional exemption
that compiling, linking, and/or using OpenSSL is allowed.
You are free to remove this exemption from derived works.

Expand All @@ -32,7 +32,6 @@ __thread int bicycle_thread_id;

/*** Malloc hooks ***/
#define BICYCLE_MALLOC
#ifdef BICYCLE_MALLOC
extern "C" {
extern __typeof (malloc) __libc_malloc;
extern __typeof (free) __libc_free;
Expand Down Expand Up @@ -147,7 +146,6 @@ void free (void *ptr) {
return zallocator->free (ptr);
}
}
#endif

int get_thread_id() {
return bicycle_thread_id;
Expand Down
71 changes: 44 additions & 27 deletions copyexec/copyexec-err.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,36 +1,53 @@
#!/usr/bin/python
import sys, os

def header (f):
f.write ('/* Generated by python script */\n')
class SuperFile:
def __init__(self, name):
self.path = os.path.join(sys.path[0], name)
self.lines = ['/* Generated by python script */']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unique & best EDB to PST software have excellent availability to extract EDB file from corrupt Exchange database and convert EDB to PST without any mistake in your internal stored EDB data. With best EDB to PST Converter tool user can comfortably ...
Мой компьютер >> Офис >> Перекодировщики

def __enter__(self):
return self
def __exit__(self, type, value, traceback):
with open(self.path, 'w') as f:
f.write('\n'.join(self.lines) + '\n')
def append(self, line):
self.lines.append(line)

errors = ['LSEEK', 'READ', 'CRC32', 'TYPE', 'DECRYPT', 'MALLOC', 'ALIGN', 'SIZE', 'SHA1', 'MKDIR', 'OPEN', 'FSTAT']
errors += ['ST_DEV', 'ST_INO', 'READIN', 'STATUS', 'FORK', 'CHDIR', 'CREAT', 'STAT', 'PUBKEY_PERMISSIONS']
errors = [
'LSEEK', 'READ', 'CRC32', 'TYPE', 'DECRYPT', 'MALLOC', 'ALIGN', 'SIZE',
'SHA1', 'MKDIR', 'OPEN', 'FSTAT'
]
errors += [
'ST_DEV', 'ST_INO', 'READIN', 'STATUS', 'FORK', 'CHDIR', 'CREAT', 'STAT',
'PUBKEY_PERMISSIONS'
]
errors += ['INVAL']

########### copyexec-results errors ###########
errors += ['VOLUME_ID_MISMATCHED', 'HOSTNAME_MISMATCHED', 'DISCONNECT', 'OLD_RESULT']
errors += [
'VOLUME_ID_MISMATCHED', 'HOSTNAME_MISMATCHED', 'DISCONNECT', 'OLD_RESULT'
]

e = [(s, -(i+1)) for i, s in enumerate (errors)]
e.append (('UNKNOWN', -999))
errors = [(s, -(i+1)) for i, s in enumerate (errors)]
errors.append (('UNKNOWN', -999))

f = open (os.path.join (sys.path[0], 'copyexec-err.h'), 'w')
header (f)
for s, i in e:
f.write ('#define COPYEXEC_ERR_' + s + ' (' + str (i) + ')\n')
f.write ('char *copyexec_strerror (int err);\n')
f.close ()
f = open (os.path.join (sys.path[0], 'copyexec-err.c'), 'w')
header (f)
f.write ('#include <stdio.h>\n')
f.write ('#include <assert.h>\n')
f.write ('#include "copyexec-err.h"\n')
f.write ('char *copyexec_strerror (int err) {\n')
f.write (' static char buf[64];')
f.write (' switch (err) {\n')
for s, i in e:
f.write (' case COPYEXEC_ERR_' + s + ': return "COPYEXEC_ERR_' + s + '"; break;\n')
f.write (' default: assert (snprintf (buf, sizeof (buf), "COPYEXEC_ERR_UNKNOWN (%d)", err) < sizeof (buf));\n')
f.write (' return buf;\n')
f.write (' }\n')
f.write ('}\n')
with SuperFile('copyexec-err.h') as f:
# not using `% tuple_ for tuple_ in errors` just for clarity
for error_name, error_code in errors:
f.append('#define COPYEXEC_ERR_%s (%d)' % (error_name, error_code))
f.append('char *copyexec_strerror (int err);')

with SuperFile('copyexec-err.c') as f:
f.append('#include <stdio.h>')
f.append('#include <assert.h>')
f.append('#include "copyexec-err.h"')
f.append('char *copyexec_strerror (int err) {')
f.append(' static char buf[64];')
f.append(' switch (err) {')
for error_name, error_code in errors:
f.append(' case COPYEXEC_ERR_%s: return "COPYEXEC_ERR_%s"; break;'
% (error_name, error_name))
f.append(' default: assert (snprintf (buf, sizeof (buf), "COPYEXEC_ERR_UNKNOWN (%d)", err) < sizeof (buf));')
f.append(' return buf;')
f.append(' }')
f.append('}')