blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
333
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
5
113
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
604 values
visit_date
timestamp[us]date
2016-08-02 21:20:34
2023-09-06 10:17:08
revision_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
committer_date
timestamp[us]date
1970-01-01 00:00:00
2023-09-05 20:12:54
github_id
int64
966
664M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]date
2012-06-18 16:43:44
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-02-03 21:17:16
2023-07-07 15:57:14
gha_language
stringclasses
121 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
128
17.8k
extension
stringclasses
134 values
content
stringlengths
128
8.19k
authors
sequencelengths
1
1
author_id
stringlengths
1
143
2f22f86e271d1871e2fe4865ff4430c80ce771a1
55da7054dabfabdfda4633a715c6f8b70cd653ec
/fly_rc/HARDWARE/uart/uart2.h
1d796ae4f25d7689979764eb1b56887e808a5266
[]
no_license
nanchuan/f_pcb4
929256c818a0b908acfe72bb9f93aba1d6049316
fd250e9fb69276cc609113009684e754a23fa618
refs/heads/master
2021-03-19T14:02:04.746398
2017-07-01T03:52:12
2017-07-01T03:52:12
95,938,133
0
0
null
null
null
null
GB18030
C
false
false
1,433
h
// Copyright (c) 2013 [email protected] All rights reserved. // ================================================== // ========圆点博士微型四轴飞行器配套软件声明======== // ================================================== // 圆点博士微型四轴飞行器配套软件包括上位机程序、下位机Bootloader // 、下位机App和遥控程序,及它们的源代码,以下总称“软件”。 // 软件仅提供参考,js200300953不对软件作任何担保,不对因使用该软件 // 而出现的损失负责。 // 软件可以以学习为目的修改和使用,但不允许以商业的目的使用该软件。 // 修改该软件时,必须保留原版权声明。 // // 更多资料见: // http://blog.sina.com.cn/js200300953 // http://www.etootle.com/ // http://www.eeboard.com/bbs/forum-98-1.html#separatorline // 圆点博士微型四轴飞行器QQ群:276721324 // bsp/uart1.h // 2013-6-1 13:46:18 // js200300953 #ifndef __FILE_BSP_UART1_H__ #define __FILE_BSP_UART1_H__ #include <stdint.h> enum { UART2_SUCCEED = 0, UART2_FAILED = 1 }; void uart2_init(void); uint8_t uart2_transmit(const void * data,uint32_t len); int32_t uart2_receiveValidBufferSize(void); int32_t uart2_readReceiveBuffer(void * outputBuffer,int32_t outputBufferLength); uint8_t uart2_receivePushToBuffer(uint8_t data); #endif // __FILE_BSP_UART1_H__
62feed749ef7b004ea130ce68f54f1f9b386f2e7
7454057be82d7f4d7c38570ac349bca6027242ba
/ft_putendl.c
9abdaf3da034094f567fe8d1764ee2825ae36d18
[]
no_license
azazelija/Libft
7198e255ab225b4ec0184c6f5bad132d98c91bc4
85d358ec4b4f1934f7cfbd000e64f3d8f1ba7939
refs/heads/master
2020-09-23T10:26:21.426934
2019-12-02T22:12:22
2019-12-02T22:12:22
225,476,269
3
0
null
null
null
null
UTF-8
C
false
false
1,019
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putendl.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: fculator <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/09/13 15:20:01 by fculator #+# #+# */ /* Updated: 2019/09/13 15:21:11 by fculator ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_putendl(char const *s) { if (s) { ft_putstr(s); ft_putchar('\n'); } }
d52b0c773fb1b3a803e2c044b77f441b33fe01cc
dd80a584130ef1a0333429ba76c1cee0eb40df73
/bionic/libc/bionic/sigsuspend.c
fd0863167e893e608f09f85d037a5c07b7325fab
[ "MIT", "BSD-4-Clause-UC", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "Martin-Birgmeier", "dtoa", "HPND", "SunPro", "CMU-Mach", "ISC", "Apache-2.0", "BSD-2-Clause", "BSD-4-Clause", "BSD-4.3TAHOE", "LicenseRef-scancode-ibm-dhcp" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
C
false
false
1,741
c
/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <signal.h> #ifdef __mips__ extern int __sigsuspend(const sigset_t *); #else extern int __sigsuspend(int, int, unsigned int); #endif int sigsuspend(const sigset_t *_mask) { #ifdef __mips__ return __sigsuspend(_mask); #else unsigned int mask = (unsigned int)*_mask; return __sigsuspend(0, 0, mask); #endif }
df9a25416770b0ee59ebf8cac167abbde5b9b678
cef3847d71d1ee28672e7a0930d4231bb69468e9
/bmd/PKG/chip/bcm56640_a0/bcm56640_a0_bmd_vlan_create.c
80c6470c2688d15c524f0d0d89904b13915c1d64
[]
no_license
babyge/OpenMDK
70e4de4ff7176d14040797e2d458d8d238f5bad6
a5d3fc9b12af3eeb68f2ca0ce7ec4056cd14d6c2
refs/heads/master
2022-12-23T18:32:44.037066
2020-09-25T20:48:23
2020-09-28T20:22:12
null
0
0
null
null
null
null
UTF-8
C
false
false
1,309
c
#include <bmd_config.h> #if CDK_CONFIG_INCLUDE_BCM56640_A0 == 1 /* * * This software is governed by the Broadcom Switch APIs license. * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenMDK/master/Legal/LICENSE file. * * Copyright 2007-2020 Broadcom Inc. All rights reserved. */ #include <bmd/bmd.h> #include <cdk/chip/bcm56640_a0_defs.h> #include "bcm56640_a0_bmd.h" int bcm56640_a0_bmd_vlan_create(int unit, int vlan) { int ioerr = 0; VLAN_TABm_t vlan_tab; EGR_VLANm_t egr_vlan; BMD_CHECK_UNIT(unit); BMD_CHECK_VLAN(unit, vlan); ioerr += READ_VLAN_TABm(unit, vlan, &vlan_tab); if (VLAN_TABm_STGf_GET(vlan_tab) == 1) { return CDK_E_EXISTS; } VLAN_TABm_STGf_SET(vlan_tab, 1); VLAN_TABm_VALIDf_SET(vlan_tab, 1); VLAN_TABm_VLAN_PROFILE_PTRf_SET(vlan_tab, VLAN_PROFILE_TABm_MAX); ioerr += WRITE_VLAN_TABm(unit, vlan, vlan_tab); ioerr += READ_EGR_VLANm(unit, vlan, &egr_vlan); EGR_VLANm_STGf_SET(egr_vlan, 1); EGR_VLANm_VALIDf_SET(egr_vlan, 1); EGR_VLANm_UT_BITMAP_W0f_SET(egr_vlan, 0); EGR_VLANm_UT_BITMAP_W1f_SET(egr_vlan, 0); ioerr += WRITE_EGR_VLANm(unit, vlan, egr_vlan); return ioerr ? CDK_E_IO : CDK_E_NONE; } #endif /* CDK_CONFIG_INCLUDE_BCM56640_A0 */
527f311194b3dc7292599e8683fad5ff9d57a920
5c255f911786e984286b1f7a4e6091a68419d049
/code/9a890199-9425-400c-b9dc-6c811eaed1d7.c
d75d5f88b238cb9b90761fa1fe5682ae0f30b056
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
253
c
#include <stdio.h> int main() { int i=0; int j=14; int k; int l; j = 53; l = 64; k = i/j; l = i/j; l = l/j; l = i/j; l = l%j; l = l%j; k = k-k*i; printf("vulnerability"); printf("%d%d\n",k,l); return 0; }
2c5491a6a1c0e55fb19f4848452fd4158344a756
6fef45c2c40853ddeeb683789f454792efb96679
/0x0C-more_malloc_free/2-calloc.c
edb5380d8960c9945de71c1590be0effa219770b
[]
no_license
mauriciosierrac/holbertonschool-low_level_programming
0820e81c3c1458fb0ad27b3abdcda0901065de7f
9414f725a6c7ee1f346f88971707a00931c041be
refs/heads/master
2023-04-10T19:34:14.373513
2021-04-21T17:19:38
2021-04-21T17:19:38
296,068,917
0
0
null
null
null
null
UTF-8
C
false
false
418
c
#include "holberton.h" #include <stdio.h> #include <stdlib.h> /** * _calloc - create matrix * @nmemb: rows * @size: column * Return: pointer to zero **/ void *_calloc(unsigned int nmemb, unsigned int size) { char *s; unsigned int i; if (nmemb == 0 || size == 0) { return (NULL); } s = malloc(nmemb * size); if (s == NULL) { return (NULL); } for (i = 0; i < nmemb * size; i++) { s[i] = 0; } return (s); }
80c3ad904a90fcf860d963752040fd3bbf074300
52c0949315583ba8898694cceacfaafaeab6f902
/third_party/libpg_query/src/postgres/include/postmaster/pgarch.h
425e2ab4f031b7e730b2e8f1f031f19a4578c3d4
[ "MIT", "BSD-3-Clause", "PostgreSQL", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cmu-db/noisepage
97093adcc9474419e063fdd97a5aa7a7ea6f3150
79276e68fe83322f1249e8a8be96bd63c583ae56
refs/heads/master
2023-08-29T05:51:04.628704
2021-11-05T14:12:08
2021-11-05T14:12:08
140,325,970
1,245
287
MIT
2022-11-08T02:06:48
2018-07-09T18:22:34
C++
UTF-8
C
false
false
1,125
h
/*------------------------------------------------------------------------- * * pgarch.h * Exports from postmaster/pgarch.c. * * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/postmaster/pgarch.h * *------------------------------------------------------------------------- */ #ifndef _PGARCH_H #define _PGARCH_H /* ---------- * Archiver control info. * * We expect that archivable files within pg_xlog will have names between * MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters * appearing in VALID_XFN_CHARS. The status files in archive_status have * corresponding names with ".ready" or ".done" appended. * ---------- */ #define MIN_XFN_CHARS 16 #define MAX_XFN_CHARS 40 #define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial" /* ---------- * Functions called from postmaster * ---------- */ extern int pgarch_start(void); #ifdef EXEC_BACKEND extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn(); #endif #endif /* _PGARCH_H */
d03407e05b148bd85c08ac16331c2742fc9ff52c
ffb9b89c791c3f411d1f3d331522aa5bd3b77fce
/book/07Graph/02AdjListGraph/AdjListGraph.h
d419ee6d03cfbf0271bb870f37246d0cfbf72bc5
[]
no_license
cwx2810/trainingForC
6eb222603b231deaa9c1646ae149dd77f791bfa0
1d6c509f2022bc45e92b3b8b6807a674f8a4d8f1
refs/heads/master
2020-03-15T19:20:05.573546
2018-08-10T16:09:24
2018-08-10T16:09:24
132,305,918
0
0
null
null
null
null
GB18030
C
false
false
1,267
h
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <stdarg.h> #include <time.h> #include "../../01intro/Status.h" #include "../../01intro/Scanf.c" #include "../../03StackAndQueue/07LinkQueue/LinkQueue.c" //图类型和弧携带的信息 typedef enum { DirectGraph, UnDirectGraph }GraphKind; typedef struct { int info; }ArcInfo; //表节点 typedef struct ArcNode { int order; struct ArcNode* nextArc; ArcInfo info; }ArcNode; //头结点 typedef struct VexNode { char data; ArcNode* firstArc; }VexNode; typedef VexNode AdjList[21];//把头结点定义为邻接表,并给与容量,使头结点变为图中的一个小结构,这个容器包含了头结点和这个节点能连上的所有节点 typedef struct { AdjList vertex;//邻接表小容器 int vexNum, arcNum;//顶点和边数量 int arcInfo;//弧信息 GraphKind kind;//图类型 }ALGraph; //全局变量 int Visited[21];//标志数组标志该节点是否被访问,后面的程序《求关节点》要用到 int CreateGraph_AL(FILE* fp, ALGraph *G); int CreateDirectGraph_AL(FILE* fp, ALGraph *G); int CreateUnDirectGraph_AL(FILE* fp, ALGraph *G); int LocateVertex_AL(ALGraph G, char e); int Output_AL(ALGraph G); int Input_AL(FILE* fp, ArcInfo* info);
4cd4dc7d790de078f32662d7849a12b80fe70795
4fb2940150e1279168ee69c71e7cffd96e2f6920
/arch/arm/mach-mmp/include/mach/mmp2.h
8f2cc72709339e667be48f8ac1fd2a5acdc95679
[]
no_license
mhrsolanki2020/Dhollmen_Kernel
740d33825301dd191cc6243f5fc7ef9cb67ed3fb
c144e86a40e514c21c28621ba43f37fae8f1c0d1
refs/heads/master
2021-01-18T20:17:29.719478
2014-04-15T00:16:49
2014-04-15T00:16:49
19,468,965
0
1
null
null
null
null
UTF-8
C
false
false
2,343
h
#ifndef __ASM_MACH_MMP2_H #define __ASM_MACH_MMP2_H #include <plat/sdhci.h> struct sys_timer; extern struct sys_timer mmp2_timer; extern void __init mmp2_init_icu(void); extern void __init mmp2_init_irq(void); extern void mmp2_clear_pmic_int(void); #include <linux/i2c.h> #include <linux/i2c/pxa-i2c.h> #include <mach/devices.h> extern struct pxa_device_desc mmp2_device_uart1; extern struct pxa_device_desc mmp2_device_uart2; extern struct pxa_device_desc mmp2_device_uart3; extern struct pxa_device_desc mmp2_device_uart4; extern struct pxa_device_desc mmp2_device_twsi1; extern struct pxa_device_desc mmp2_device_twsi2; extern struct pxa_device_desc mmp2_device_twsi3; extern struct pxa_device_desc mmp2_device_twsi4; extern struct pxa_device_desc mmp2_device_twsi5; extern struct pxa_device_desc mmp2_device_twsi6; extern struct pxa_device_desc mmp2_device_sdh0; extern struct pxa_device_desc mmp2_device_sdh1; extern struct pxa_device_desc mmp2_device_sdh2; extern struct pxa_device_desc mmp2_device_sdh3; static inline int mmp2_add_uart(int id) { struct pxa_device_desc *d = NULL; switch (id) { case 1: d = &mmp2_device_uart1; break; case 2: d = &mmp2_device_uart2; break; case 3: d = &mmp2_device_uart3; break; case 4: d = &mmp2_device_uart4; break; default: return -EINVAL; } return pxa_register_device(d, NULL, 0); } static inline int mmp2_add_twsi(int id, struct i2c_pxa_platform_data *data, struct i2c_board_info *info, unsigned size) { struct pxa_device_desc *d = NULL; int ret; switch (id) { case 1: d = &mmp2_device_twsi1; break; case 2: d = &mmp2_device_twsi2; break; case 3: d = &mmp2_device_twsi3; break; case 4: d = &mmp2_device_twsi4; break; case 5: d = &mmp2_device_twsi5; break; case 6: d = &mmp2_device_twsi6; break; default: return -EINVAL; } ret = i2c_register_board_info(id - 1, info, size); if (ret) return ret; return pxa_register_device(d, data, sizeof(*data)); } static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data) { struct pxa_device_desc *d = NULL; switch (id) { case 0: d = &mmp2_device_sdh0; break; case 1: d = &mmp2_device_sdh1; break; case 2: d = &mmp2_device_sdh2; break; case 3: d = &mmp2_device_sdh3; break; default: return -EINVAL; } return pxa_register_device(d, data, sizeof(*data)); } #endif /* __ASM_MACH_MMP2_H */
20e1104c487142bc3acfd44d66319c8f9157c3e1
2fe9ccc7f0467c981a5279e1b5513f551610acde
/libft/src/ft_memalloc.c
f48c82add278880a8b40a0f7baad076f4935e039
[]
no_license
dmelehov/Wolf3d
3a24ed48db36f5b92918917dcfc9b4fa8307afcb
5930d446582155fb4c0c1d71d91667c78b226e7e
refs/heads/master
2021-08-26T08:15:37.729670
2017-11-22T13:17:49
2017-11-22T13:17:49
111,686,160
0
0
null
null
null
null
UTF-8
C
false
false
1,083
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memalloc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dmelehov <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 19:07:23 by dmelehov #+# #+# */ /* Updated: 2016/12/07 20:53:07 by dmelehov ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_memalloc(size_t size) { void *s; s = (void *)malloc(size); if (s == NULL) return (NULL); while (size--) *(unsigned char *)(s + size) = 0; return (s); }
f42df3b30ca43c4053fdf272a7d49877ed2e2206
a1a884019710dbf78e736b91d5686645b57c6784
/book001/chap07/typedef.c
87d7d853e31fd39adc791d59e4f9d6786a8df155
[]
no_license
cl-kn/c_study
82fe84a947d4b500e5f552849e362ecb69b1b5a8
f51793c50fbdd340939f479366351e0aeb178ea8
refs/heads/main
2023-04-10T19:46:12.964450
2021-04-25T06:29:00
2021-04-25T06:29:00
307,684,995
0
0
null
null
null
null
UTF-8
C
false
false
399
c
//*************************************************** /** typedef宣言 * 型の同義語を作る宣言(※新しい型を作るのではない) */ //*************************************************** #include <stdio.h> int main(void) { typedef int intkun; intkun x = 55; int y = 10; printf("intkun型: x = %d\n", x); printf("int型: y = %d\n", y); return 0; }
642f5971909a4276f53114077c866480a86d04fa
b6dbe0c23729eb969a9e998bb740bbcfd13a6fa2
/CPool_Day06_2019/tests/test_my_revstr.c
9835dc7d2f98de94bc9edae745696a4754406000
[]
no_license
c-louis/EpitechYear1
0ace7bda0d4002f75e3ff6b7f1ba5b60fd7dbf69
c11bef8108c1f2d7f56609300c8e4a48eda907ca
refs/heads/master
2023-05-07T10:07:49.916646
2021-06-02T21:25:16
2021-06-02T21:25:16
373,298,768
0
0
null
null
null
null
UTF-8
C
false
false
287
c
/* ** EPITECH PROJECT, 2019 ** test_my_revstr ** File description: ** test for reverse string */ #include <criterion/criterion.h> char *my_revstr(char *str); Test(my_revstr, reverse_all_a_string) { char str[6] = "Hello"; my_revstr(str); cr_assert_str_eq(str, "olleH"); }
31d0f26556e9616bb5a451801bb8c7e99dc15979
2bc3398063fd7251c46a2d93d2e301cd063befcd
/nitan/d/foshan/npc/jiading.c
a61eaf32b316969b9e8a1471bfaad1f6a4edcfa4
[ "MIT" ]
permissive
HKMUD/NT6
ae6a3c173ea07c156e8dc387b3ec21f3280ee0be
bb518e2831edc6a83d25eccd99271da06eba8176
refs/heads/master
2020-03-18T08:44:12.400598
2018-05-23T06:55:18
2018-05-23T06:55:18
134,525,191
9
4
null
null
null
null
GB18030
C
false
false
559
c
// jiading.c 家丁 inherit NPC; void create() { set_name("家丁", ({ "jia ding", "jia" })); set("gender", "男性"); set("age", 35); set("long", "佛山凤老爷府上的家丁。占势欺人,横行霸道。\n"); set("combat_exp", 4000); set_skill("dodge", 20); set_skill("unarmed", 20); set_temp("apply/attack", 10); set_temp("apply/defense", 10); set("shen_type", -1); setup(); add_money("silver",3); carry_object("/clone/misc/cloth")->wear(); }
4418eb2095f6534c91e14aee323272f6dfdc099f
b86b23938f6048a214b4b871e5ade514101ee041
/hw4/lib/handy/cnds/cn_shvec.c
be9ca6eb46c90a1e094f5e5310892d3c3328bc48
[]
no_license
iDestyKK/cs462_gb
03fc9743b4e43e78804227edfee4659aab0d08b6
f7e015c5a8da999e12939b7f746a410d0d9d8da9
refs/heads/master
2022-12-23T05:39:29.036712
2020-09-22T06:47:57
2020-09-22T06:47:57
297,557,783
0
0
null
null
null
null
UTF-8
C
false
false
6,527
c
/* * CN_Vec Library * * Version 1.0.2 (Last Updated 2016-05-20) * * Description: * C++ Vectors for C library. Implements the data structure with a struct * and use of realloc() along with exponential expansion via a binary math. * Any datatype can be stored in a CN_Vec, just like C++ Vectors. * * Changelog of library is located at the bottom of "cn_vec.h" * * Author: * Clara Van Nguyen * * For documentation and details on every function in this library, visit the following URL: * http://web.eecs.utk.edu/~ssmit285/lib/cn_vec/index.html */ #include <shmem.h> #include "cn_vec.h" //Functions //Initializer CN_VEC new_cn_vec(cnv_uint size) { //Initializes the new vector. It needs the size of the data type we are storing in it. CN_VEC vec = (CN_VEC) shmalloc(sizeof(struct cn_vec)); vec->size = 0; vec->data = NULL; //The void of space as we know it. vec->elem_size = size; //Size of each element. vec->capacity = 0; return vec; } //Add void cn_vec_push_back(CN_VEC vec, void* ptr) { //cnv_uint __cap = __cn_vec_gen_capacity(vec->size + 1); /*if (vec->size == 0) { //Our vector is empty. Initialize the memory properly. vec->data = (void *) shmalloc(vec->elem_size); if (vec->data != NULL) memcpy(vec->data, ptr, vec->elem_size); } else { //It's already allocated. Let's expand on it. if (__cap != vec->capacity) { void* new_vec = realloc(vec->data, vec->elem_size * __cap); if (!new_vec) { return; //Memory Error } else { vec->data = new_vec; } } memcpy(vec->data + (vec->size * vec->elem_size), ptr, vec->elem_size); } vec->size++;*/ cn_vec_resize(vec, vec->size + 1); memcpy((char*)vec->data + ((vec->size - 1) * vec->elem_size), ptr, vec->elem_size); } void cn_vec_insert(CN_VEC vec, cnv_uint pos, void* ptr) { if (pos == vec->size - 1) cn_vec_push_back(vec, ptr); //Cheat else if (pos >= vec->size) return; //Out of bounds else { cn_vec_resize(vec, vec->size + 1); //Abuse the fact that memmove uses a buffer to allow overlaying memmove((char*)vec->data + ((pos + 1) * vec->elem_size), (char*)vec->data + (pos * vec->elem_size), (vec->size - 1 - pos) * vec->elem_size); memcpy((char*)vec->data + (pos * vec->elem_size), ptr, vec->elem_size); } } //Set void cn_vec_resize(CN_VEC vec, cnv_uint size) { cnv_uint __cap = __cn_vec_gen_capacity(size); if (vec->data == NULL) vec->data = (void *) shmalloc(vec->elem_size * __cap); else if (__cap != vec->capacity) { if (size == 0) free(vec->data); else { void* new_vec = (void *) shrealloc((char*)vec->data, vec->elem_size * __cap); if (!new_vec) return; //Memory Error else vec->data = new_vec; } } vec->size = size; vec->capacity = __cap; } void cn_vec_set(CN_VEC vec, cnv_uint pos, void* ptr) { if (pos >= vec->size) return; //You failed. memcpy((char*)vec->data + (pos * vec->elem_size), ptr, vec->elem_size); } void cn_vec_delete(CN_VEC vec, cnv_uint pos) { memmove((char*)vec->data + (pos * vec->elem_size), (char*)vec->data + ((pos + 1) * vec->elem_size), (vec->size - 1 - pos) * vec->elem_size); /*cnv_uint i = pos; for (; i < vec->size - 1; i++) memcpy(vec->data + (i * vec->elem_size), vec->data + ((i + 1) * vec->elem_size), vec->elem_size);*/ cn_vec_resize(vec, vec->size - 1); } void cn_vec_copy(CN_VEC dest, CN_VEC src) { if (dest == NULL || src == NULL) return; dest->size = src->size; dest->elem_size = src->elem_size; dest->capacity = src->capacity; cn_vec_resize(dest, src->size); memcpy(dest->data, src->data, src->size * src->elem_size); } //Modify void cn_vec_clear(CN_VEC vec) { free(vec->data); vec->size = 0; } void cn_vec_swap(CN_VEC vec, cnv_uint pos1, cnv_uint pos2) { if (pos1 != pos2 && pos1 < vec->size && pos2 < vec->size) { cnv_uint i = 0; cnv_byte *b1, *b2; //XOR Swap > Malloc & Free... by 0.1 seconds :) b1 = (char*)vec->data + (pos1 * vec->elem_size); b2 = (char*)vec->data + (pos2 * vec->elem_size); for (; i < vec->elem_size; i++) { *b1 ^= *b2; *b2 ^= *b1; *b1++ ^= *b2++; } } /*void* tmp = (void *) shmalloc(vec->elem_size); memcpy(tmp, vec->data + (pos1 * vec->elem_size), vec->elem_size); memcpy(vec->data + (pos1 * vec->elem_size), vec->data + (pos2 * vec->elem_size), vec->elem_size); memcpy(vec->data + (pos2 * vec->elem_size), tmp, vec->elem_size); free(tmp);*/ } void cn_vec_reverse(CN_VEC vec) { cnv_uint i = 0, sr = cn_vec_size(vec), s = sr / 2; //Round down sr--; for (; i < s; i++) { cn_vec_swap(vec, i, sr - i); } } /*void cn_vec_sort(CN_VEC vec, void (*func)(void*, void*)) { //TODO: Add Sort Functionality (Merge Sort? QSort?) }*/ //Get void* cn_vec_at(CN_VEC vec, cnv_uint pos) { //Returns the address of an entry in the vector at position "pos". if (pos < 0 || pos >= vec->size) return (void*)0xDEADBEEF; //Nice try. Segfault land for you buddy. return (char*)vec->data + (pos * vec->elem_size); //I'm in a good mood today. } cnv_uint cn_vec_size(CN_VEC vec) { return vec->size; } cnv_uint cn_vec_element_size(CN_VEC vec) { return vec->elem_size; } cnv_uint cn_vec_capacity(CN_VEC vec) { return vec->capacity; } cnv_byte cn_vec_empty(CN_VEC vec) { return (vec->size == 0); } void* cn_vec_data(CN_VEC vec) { return vec->data; } //Iteration void* cn_vec_begin (CN_VEC vec) { return vec->data; } void* cn_vec_end (CN_VEC vec) { return (char*)vec->data + (vec->size * vec->elem_size); } void* cn_vec_rbegin(CN_VEC vec) { return (char*)vec->data + (vec->size * vec->elem_size) - vec->elem_size; } void* cn_vec_rend (CN_VEC vec) { return (char*)vec->data - vec->elem_size; } //Deinitializer void cn_vec_free(CN_VEC vec) { if (vec->size != 0) shfree(vec->data); shfree(vec); vec = NULL; } //Functions you won't use if you are sane cnv_uint __cn_vec_gen_capacity(cnv_uint size) { //Constant time implementation size--; size |= size >> 1 | size >> 2 | size >> 4 | size >> 8 | size >> 16; return ++size; }
b1b71eba486cba71fd64368d37c8c5b42d55ffc7
c2cb7aef34fde7f7cab40c80538ad7ac77f5d581
/Code/node2/node2.c
83d6e715479cd40ffe679a12848ac24e9171c4af
[]
no_license
martiege/TTK4155-Industrielle-og-innbygde-datasystemers-konstruksjon-Byggern
19cd71178a3fff408c3982b2217dfb864219507c
16b0dbbdcfb04b1401ceb1108b4e87556d1de6fd
refs/heads/master
2020-03-28T01:01:15.850052
2018-11-21T08:58:53
2018-11-21T08:58:53
147,469,520
0
0
null
null
null
null
UTF-8
C
false
false
807
c
#include "node2.h" #include "../lib/defines.h" #include "../lib/UART.h" #include "../lib/SPI.h" #include "../lib/MCP.h" #include "../lib/CAN.h" #include "../lib/input_com.h" #include "pwm.h" #include "ADC_internal.h" #include "goal.h" #include "solenoid.h" #include "TWI_Master.h" #include "motor.h" #include "controller.h" #include <util/delay.h> void node2_init() { UART_Init(MYUBRR); MCUCR |= (1 << SRE); printf("Initializing...\n"); SPI_MasterInit(); MCP_reset(); CAN_init(); input_com_init(); pwm_init(); ADC_internal_init(); solenoid_init(); TWI_Master_Initialise(); motor_init(); controller_init(4, 0, 4); printf("Initialized!\n"); } void node2_main() { while (1) { _delay_ms(100); controller_update(); } }
efd64d262e50d5092c4f73ff8b84e8e03b31b7b3
80dd23b3433fcb641f2303c2524f01b9704a7711
/Experiment/实验4/奖学金发放/实验四奖学金发放/main.c
9516ee63f6cc95ab6c987979285f981c986f5f99
[]
no_license
null395922/C_Code
f0f445ba236de9e7b6ee1b252e89311975d97d3c
31d57bf79beb8333a915c6858b95204b8dbd0b5c
refs/heads/master
2023-03-16T19:41:09.419090
2020-05-17T03:49:55
2020-05-17T03:49:55
null
0
0
null
null
null
null
GB18030
C
false
false
1,238
c
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a[10],b[10],c[10];///a用于存储学号,b用于存储成绩,c用于存储奖项 int i; float aver=0; srand(time(0)); for(i=0;i<10;i++) { a[i]=1811101+i; b[i]=rand()%100+1; } for(i=0;i<10;i++) { aver+=b[i]; } printf(" 10名学生的成绩分别为:\n"); for(i=0;i<10;i++) { printf("%4d",b[i]); } printf("\n\n"); aver=aver/10; printf(" 获一等奖的最低分是:%.2f\n",1.1*aver); printf(" 获二等奖的最低分是:%.2f\n",1.05*aver); for(i=0;i<10;i++) { if(b[i]>1.1*aver) { c[i]=1; } else if(b[i]>1.05*aver) { c[i]=2; } else { c[i]=0; } } printf("\n 学号 成绩 奖金 \n"); for(i=0;i<10;i++) { printf("%8d %4d ",a[i],b[i]); if(c[i]==1) { printf("一等奖\n"); } else if(c[i]==2) { printf("二等奖\n"); } else { printf("无奖金\n"); } printf("\n"); } return 0; }
98950966dce614e89162584d1fb25e7e88225f2a
53d4815f620a320db126a4ab02c953b1dba27d67
/0x02-functions_nested_loops/8-main.c
2e28650ae4237a7dc56301a9ec0a0443aaf504cc
[]
no_license
fifisaad/holbertonschool-low_level_programming
24eac217899e81dd988a81cc67bf168ceb4a3b98
657498c9ae8bd858f4ebea620155494d312628a4
refs/heads/master
2023-06-25T09:01:06.795977
2021-07-25T19:02:01
2021-07-25T19:02:01
null
0
0
null
null
null
null
UTF-8
C
false
false
158
c
include "holberton.h" /** * main - check the code for Holberton School students. * * Return: Always 0. */ int main(void) { jack_bauer(); return (0); }
2312c42415584f9ed6d3ad6ad3f78b53a381a55b
62bb05f5d6735668585042186cf44b688889c835
/0x0D-structures_typedef/5-free_dog.c
b42ee2a4a65b23258ebd2237917e1d7b90cd30eb
[]
no_license
mKleinCreative/holbertonschool-low_level_programming-1
4adc3933ac30f08c9ba3dbe4dc16a504c316fffc
8f9dbd31e516b61d8621aa744a28696f19229a5d
refs/heads/master
2020-04-10T20:06:51.921470
2018-12-10T20:39:33
2018-12-10T20:39:33
161,257,518
1
0
null
2018-12-11T01:07:54
2018-12-11T01:07:53
null
UTF-8
C
false
false
236
c
#include "dog.h" #include <stdio.h> #include <stdlib.h> /** * free_dog - frees dogs * @d: the structure to free * Return: no value */ void free_dog(dog_t *d) { if (d == NULL) return; free(d->name); free(d->owner); free(d); }
b4b208f261a1ac2e0a9cacf3e84af16cf6846333
bfbc1e3b667f11fb41a4b8ceb354d88f40266cfd
/hc32f460_sdk/驱动库及样例/hc32f46x_ddl/usb_lib/ctl_drv/usb_dcd_int.h
2fc7d9354e5a2b004eb24627f5d5db261c31621a
[]
no_license
wellrun/hc32f460
40a613d7479fa560e6d72c33f2f1b83c27d8c18c
f8576ca78bfd52cd56d4ff89ea5133711a202c8a
refs/heads/master
2020-06-17T00:30:04.501954
2019-07-08T02:21:54
2019-07-08T02:21:54
195,743,343
6
6
null
2019-07-08T05:36:35
2019-07-08T05:36:35
null
UTF-8
C
false
false
4,944
h
/****************************************************************************** * Copyright (C) 2016, Huada Semiconductor Co.,Ltd. All rights reserved. * * This software is owned and published by: * Huada Semiconductor Co.,Ltd ("HDSC"). * * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. * * This software contains source code for use with HDSC * components. This software is licensed by HDSC to be adapted only * for use in systems utilizing HDSC components. HDSC shall not be * responsible for misuse or illegal use of this software for devices not * supported herein. HDSC is providing this software "AS IS" and will * not be responsible for issues arising from incorrect user implementation * of the software. * * Disclaimer: * HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE, * REGARDING THE SOFTWARE (INCLUDING ANY ACCOMPANYING WRITTEN MATERIALS), * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED * WARRANTY OF NONINFRINGEMENT. * HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, * SAVINGS OR PROFITS, * EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED * FROM, THE SOFTWARE. * * This software may be replicated in part or whole for the licensed use, * with the restriction that this Disclaimer and Copyright notice must be * included with each copy of this software, whether used in part or whole, * at all times. */ /******************************************************************************/ /** \file usbd_desc.h ** ** A detailed description is available at ** @link Peripheral Device Interface Layer @endlink ** ** - 2018-12-26 1.0 wangmin First version for USB demo. ** ******************************************************************************/ #ifndef USB_DCD_INT_H__ #define USB_DCD_INT_H__ /******************************************************************************* * Include files ******************************************************************************/ #include "usb_dcd.h" /******************************************************************************* * Global type definitions ('typedef') ******************************************************************************/ typedef struct _USBD_DCD_INT { uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); }USBD_DCD_INT_cb_TypeDef; /******************************************************************************* * Global pre-processor symbols/macros ('#define') ******************************************************************************/ #define CLEAR_IN_EP_INTR(epnum,intr) \ diepint.d32=0; \ diepint.b.intr = 1; \ USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32); #define CLEAR_OUT_EP_INTR(epnum,intr) \ doepint.d32=0; \ doepint.b.intr = 1; \ USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32); /******************************************************************************* * Global variable definitions ('extern') ******************************************************************************/ extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; /******************************************************************************* Global function prototypes (definition in C source) ******************************************************************************/ #endif // USB_DCD_INT_H__ /******************************************************************************* * EOF (not truncated) ******************************************************************************/
464a96b30bb024836c4f4ed06622fdeaffce054d
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/e9b56242-29ce-4014-a191-a693f5f709ef.c
eb7f5b13a58c6be817848f296509b83a1bd58782
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
717
c
#include <string.h> #include <stdio.h> int sum(int a) ; int main() { int num; int result; printf("Enter the number: "); num = 00.00; //variables //random /* START VULNERABILITY */ int a; int b[71]; int c[8]; a = 0; while (b[( a - 1 )] != 0) { a++; /* START BUFFER SET */ *((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 )); /* END BUFFER SET */ //random } /* END VULNERABILITY */ result = sum(num); printf("Sum of diggits in %d is %d\n",num,result); return 0; } int sum(int num) { if (num!=0) { return num%11+sum(num/10); } else { return 0; } }
1026ae58f4ddab6ad4f41ebf13928156aa25b9d8
26922ce0f33589caea1bdaae0aacc972d4bbb167
/microchip library/apps/gfx/primitive_layer/firmware/src/gfx_config.h
8fceeb34b19e2944209cd94dd21216bd3b50b705
[]
no_license
alexandrequ/scalar4
d3afe3b09faf6731009593b71bf971d9d862d44d
deda54a12a635720f79fee3b7ce710b124fda087
refs/heads/main
2023-03-04T09:03:20.256507
2021-02-15T20:05:24
2021-02-15T20:05:24
339,189,700
0
0
null
null
null
null
UTF-8
C
false
false
8,054
h
/******************************************************************************* Module for Microchip Graphics Library Company: Microchip Technology Inc. File Name: gfx_config.h Summary: This header file defines the Graphics Library configurations that are enabled. *******************************************************************************/ // DOM-IGNORE-BEGIN /******************************************************************************* Copyright (c) 2013 released Microchip Technology Inc. All rights reserved. Microchip licenses to you the right to use, modify, copy and distribute Software only when embedded on a Microchip microcontroller or digital signal controller that is integrated into your product or third party product (pursuant to the sublicense terms in the accompanying license agreement). You should refer to the license agreement accompanying this Software for additional information regarding your rights and obligations. SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. *******************************************************************************/ // DOM-IGNORE-END #ifndef _GRAPHICS_CONFIG_H #define _GRAPHICS_CONFIG_H //////////////////// COMPILE OPTIONS //////////////////// /********************************************************************* Overview: Blocking and Non-Blocking configuration selection. Non-Blocking is enabled by default. To disable the non-blocking feature, this macro must be enabled. GFX_CONFIG_NONBLOCKING_DISABLE ********************************************************************/ //#define GFX_CONFIG_NONBLOCKING_DISABLE /********************************************************************* Overview: To disable support for Alpha Blending. Alpha blending is feature available to certain fill functions. GFX_CONFIG_ALPHABLEND_DISABLE *********************************************************************/ //#define GFX_CONFIG_ALPHABLEND_DISABLE /********************************************************************* Overview: Filling of shapes can be optionally set to fill with gradient colors. This feature is by default enabled. To disable this feature to reduce code size, define this macro at build time. GFX_CONFIG_GRADIENT_DISABLE *********************************************************************/ //#define GFX_CONFIG_GRADIENT_DISABLE /********************************************************************* Overview: Using Palettes, different colors can be used with the same bit depth. GFX_CONFIG_PALETTE_DISABLE ********************************************************************/ #define GFX_CONFIG_PALETTE_DISABLE /********************************************************************* Overview: Palettes can also be specified to reside in external memory similar to fonts and images. Use this when the palette is located in external memory. GFX_CONFIG_PALETTE_EXTERNAL_DISABLE ********************************************************************/ #define GFX_CONFIG_PALETTE_EXTERNAL_DISABLE /********************************************************************* Overview: To enable support for unicode fonts, GFX_CONFIG_FONT_CHAR_SIZE must be defined as 16 (size is 16 bits). For standard ascii fonts, this can be defined as 8. This changes the GFX_XCHAR definition. See GFX_XCHAR for details. GFX_CONFIG_FONT_CHAR_SIZE *********************************************************************/ #define GFX_CONFIG_FONT_CHAR_SIZE 8 /********************************************************************* Overview: Font data can be placed in multiple locations. They can be placed in FLASH memory, RAM and external memory. To reduce code size, any one of these locations, when not used, can be disabled by defining the macros at build time. - GFX_CONFIG_FONT_FLASH_DISABLE - Disable font in internal flash memory support. - GFX_CONFIG_FONT_EXTERNAL_DISABLE - Disable font in external memory support. - GFX_CONFIG_FONT_RAM_DISABLE - Disable font in RAM support. *********************************************************************/ //#define GFX_CONFIG_FONT_FLASH_DISABLE #define GFX_CONFIG_FONT_EXTERNAL_DISABLE #define GFX_CONFIG_FONT_RAM_DISABLE /********************************************************************* Overview: Images can be placed in multiple locations. They can be placed in FLASH memory, RAM and external memory. To reduce code size, any one of these locations, when not used, can be disabled by defining the macros at build time. - GFX_CONFIG_IMAGE_FLASH_DISABLE - Disable images in internal flash memory support. - GFX_CONFIG_IMAGE_EXTERNAL_DISABLE - Disable images in external memory support. - GFX_CONFIG_IMAGE_RAM_DISABLE - Disable images in RAM support. *********************************************************************/ //#define GFX_CONFIG_IMAGE_FLASH_DISABLE #define GFX_CONFIG_IMAGE_EXTERNAL_DISABLE #define GFX_CONFIG_IMAGE_RAM_DISABLE /********************************************************************* Overview: Specifies the color depth used in the demo. GFX_CONFIG_COLOR_DEPTH *********************************************************************/ #define GFX_CONFIG_COLOR_DEPTH 16 /********************************************************************* Overview: To disable support for double buffering. Use this feature only if the display driver used can support double buffering. GFX_CONFIG_DOUBLE_BUFFERING_DISABLE *********************************************************************/ #define GFX_CONFIG_DOUBLE_BUFFERING_DISABLE /********************************************************************* Overview: Images with 8 and 4 BPP color depths can be optionally compressed with RLE. This feature is by default enabled. To disable this feature to reduce code size if none of the images are compressed with RLE, define this macro at build time. GFX_CONFIG_RLE_DECODE_DISABLE *********************************************************************/ //#define GFX_CONFIG_RLE_DECODE_DISABLE /********************************************************************* Overview: When using PIC24FJ256DA210, IPU compression can be enabled for images.This feature is by default enabled. To disable this feature to reduce code size if none of the images are compressed with IPU, define this macro at build time. GFX_CONFIG_IPU_DECODE_DISABLE *********************************************************************/ //#define GFX_CONFIG_IPU_DECODE_DISABLE #endif // _GRAPHICS_CONFIG_H
f19530888c6b929905bfc490c6335ec530de0ca5
6f37f529bae8bbcc99244468477f14e9f96ff95c
/wxWidgets-2.8.12/include/wx/generic/collpaneg.h
7659ecf6c577e7df0bccbc291683091b5d535ea7
[]
no_license
darknebuli/darknebuli-RM-graph
13326ddbc9a210605926f7ad4b70672a48b1b2f2
bf169c01f787fdd144e19fae6732a5b58fdbdafd
refs/heads/master
2020-05-16T23:40:56.853727
2012-04-30T22:14:24
2012-04-30T22:14:24
null
0
0
null
null
null
null
UTF-8
C
false
false
4,355
h
U2FsdGVkX19fTms3OENxUoetnOKy1AyJ49jWWmkNc76HrZzistQMiePY1lppDXO+ h62c4rLUDInj2NZaaQ1zvoetnOKy1AyJ49jWWmkNc758g4KpHaB8LwCS1iqVEAa/ y9J4KuZS13OGxraQSOpUhYeVA7qdyn5cYkZGasH1Nxn11jIbxuMbziTwW/2RRHGa pk/l+swQ63/RBZ2LKlx5FmvMdmHQqk3INdKtaoA2Je8uiuH3D6nSLAb3sY05X7+f Xq7JmfFEPbI+tqfBLWY0Y4J7poeo0JqhumADxbK0EQdC7a2DFlHEds5zkyI8lCbj 7hUiGYKgf4S/YZzXI5yO5j/LWERR8CaaTv2e4YD38CXXmmiVNvBF6yWstXSkTXRX no4zgMA3/+jRupDvEJdxiyLyMJvLpFbHg86G5aI+kyKrU3j/l7GBIIHdsHyb+NTT egNzAi6nBt1aTYbUwnxBOja8jNr0xtEp416kgm6c3nkg3Aq0VwwtWn/M3mNuRsSS 5j0iHYeFVaLHEsJKdV00wIetnOKy1AyJ49jWWmkNc76HrZzistQMiePY1lppDXO+ h62c4rLUDInj2NZaaQ1zvoetnOKy1AyJ49jWWmkNc77tTjNYahGdrAYcWUede/wu 5a9qkIe0VBSJXPDO6EnbluoZ6ePEqXDWnt+6YVz60ngTWMtW2fWU6HH+7w/fBHCq GetiObW4jNDnx07SAtbx6znfr+11uNez35L/ULqH9ZIVyNGmeKsSPQExmLOJLtAZ hBLE5TZoeW8C/X++0wpFW3Yc0lVlxvy+RuO1bc0obW6e7mRsH6ybitp8JcOkD+Ss HAZ/BhwVRwzG4sk9NkF3ko6TeeuqeSwN3ENLc0E8JkV3Xu/HxJvalxzRCdBuD2Tw Kn6q9B3Qo9NvQmaY6V5MttYJRb24AOKdfs+57yc8y19i4ULtDwYEIlklcvaZleMl a2+3tbnjB/5XqzO0cWvQJGDObcDbJ+1YyebIB/gqHVIkfUTEBQRK4Y+5lZNAjSs/ JH1ExAUESuGPuZWTQI0rPyR9RMQFBErhj7mVk0CNKz/MWqSZDsI1zQWa1TSRvqq9 QT9eh5b41s+uQYnsqslE9MqNlbJDsJtG2+EkZ/FrEeckfUTEBQRK4Y+5lZNAjSs/ JH1ExAUESuGPuZWTQI0rPyR9RMQFBErhj7mVk0CNKz8kfUTEBQRK4Y+5lZNAjSs/ ZfwHEEAQxxyjtNq948l2CeQGzH+aNgIOqgElWqEUrARg6tuqwWiLMumRVqIlBk5M VcWjacOr+fhRxOLXZv/Of7foYhz9cFmpOnlq8oAjpBrMd7DbyXLZeylwvjpL7EEX qlgNv6zC68Tjl+RSl46fez4H2burfdKBu/IHR4n0ovhOgUW9/LjCyUo8tr08L57l zijZ5UqeIPm0PhJCG3SbCoNGlW6j4XCXTSAEOws0nqPZssb0H5FzmVN9y/NdsgxM 5GXS4ZheI5QCtSaeA0rHoECkCO+ganSmDZhmAUxrQOOSUX9HxNuca0UOBB1oCFpN 5GXS4ZheI5QCtSaeA0rHoMXANIhmBZqqLAnd5zcHWSxZjzH/U4i4dlouIGJn8Uy7 5GXS4ZheI5QCtSaeA0rHoOTkwRyNzo3zPFxttlxIRKLlqaxu0xJA8d/5NibXSALj 9dTdQOilsWEeW+YW7gP8G+Rl0uGYXiOUArUmngNKx6BwYsSLjpgSdvJNPNVPARq7 HKiRKLkyeJ9HwzT+dQ8IRf4HWpE7pae+IpkEtETlP4V0c+18MFgNP0Jn9GSnJuuR a+r1L1/IjYb8pzyag/5+OlnwGMtfWGiEmhikwA/aTFTkZdLhmF4jlAK1Jp4DSseg ofBDgnwqSdcpRN6YQg0EHrGagG37wts+cokYfc4nJ3+Agv1HB/cmUWJ6XzAJ1zgV AXzo8J0Zm7IKyhtZ9wiQH9bOe8tp+18iFK240jFvex0JKIyw3xb2OixjjYMWq0kh YuFC7Q8GBCJZJXL2mZXjJR0UUsVds0yhF0zlPhtZ1jTQSRroHHKkolSl8Xq/Zb4j tTk5pI2BETMvegY1+/Mf6Ti1BMFfRrO672GmYCLwgikCJ7Fs6JJvZ52mw9vZtxUE W/i89geBGd8NagZK8k1gQGPOQYokeE0awxTVL3VwQ/1J5kE/bjcnCqKl/pvu6nzk CGTq2eZCAoUAiWslTti9cBMmj7nVxsKLzFtlcftYawJR3nsdq8WoR4QazZIp54D+ zjF975T7pB1JCvSj+uYyonjj7O9sie31ITplLa/0w9sSZ5k4f5f5ax/FEaZhIafU hkKrG4gomu3cZWxgKf6TPRjaJG63pmNVVdtG7t8kCAPhd9ViFsFXD3JSQpxbysjk JSZpHO9ZHrVOZk3QaLShlpbSfxteojURsG6GqaS6KcABfOjwnRmbsgrKG1n3CJAf LGivBVZi73GkkpK4TOq5wYgx1UZxMV//+1V2fshRN0GGVYMw5bIG4sDK0L5RJXdY FcZx8Wqe/qY98dcHL/lN64w/vnQk+2RifBNBXaMVuJ5p1hCclAqRqIGRFktUulZO oWo2rvbiGxERE5ph+omHqzlQ142HEt/jRMLF9hyPDpkXwmzXkgPnFyOxKkWCCq+t XJI2y4aIPFHWIs226/vTZAh0qX5TABkcwzPWAuQlAO9wDLFEqk3StgRLBA8qVjgT 2fknwrUV3Xr7WrOuDvCf5XOme9pgxrWrkoyf4ccQht4PuAjmVx1TqH7zGkw5rC9z kwtNzFM0Wl0gFQUicixaereyz4BfdJJUdnUn8Q8O+LYcETnAvKIfrh6z1LGsKKqq EXP/jKl5FG3QWsAXeZfDCJYPNjMYBJMULXfAoY/FH1zEAqM1oJywA0t5j/BhiyxC r8fqnMCDpjya2gdLXLtnn9CPxMQVyQvdA10PzjeF1Jmgltw6HJhO+gLJvuHcH1SL s32gl7oFHAejAAtMEZZA9+RvWrWmsEAHhezgK6XJSWXMWrh+jdTw1nlF74YSKA0x Ljq/QYQT65syu0NtmZa/mgygvIqV9FbZeQBa7Gh/uunEo97YmMZCka/I5Dqf9EzW bZS3jHfSy9JiB0GIFC5bhxCPfOmVyRD0L/G4+jrBhElais5qToR4OEnP22FxjCwg 8k8ZJ0DNvLAnZq+Fh/S/++PhK2lH9CK4dJxjYdsRLZjZcycxOKmheycG08ot2e8i eqWPaVqakE4SUDSYVJk7CGjzpZYk2Nir4vXQaJ4n1d2EMIBrSdZgAy4j+g31xqyj 9gL4LUIEkRwisslEdmhfZLPlhfp1TLUEmMacTwuZ8jg5UKoqoKkrONNSwMqw+KBC PDzdlGiHEp83ydwW+JWmUyF2cJ5r87jrNaVHHZQbV66+g5yleFMeFv5SEht9XDfj tKiTrdGags5P/n04aS2vsrfj5msEqoen/bgW7cKJCRvqj9+k4PIVdTUcAp1/em3A 31pv4ZvjaAgccT2Z85AWzG82CcAG7Y6NuMKUF+lrYLS06VH6eN4jNwnwormRxvej xrx8ZnoEkWSluIKDQ5gVZKXqRtxdZtUln7eme+ROCwE8WFVnuI0sdsimOr9vyQ3i LBdrEH/zfvSwl7L2kE7ApoP7yTTWIpk9boBqgu55TIyM2VQOyHgiVUOPxe+r3uPg JITYt4jhIiJwaJct5lTXATGwW6HFehogglF80Gm4AzRvtsgYkWP2rxf7jzy4H5xm vDMjX6wnTiWJ+MVvZoppuSHJaP6lO48KT2t+oePlIOt1dRHpG1eDTyNoTcLClw2F xlAFur+oCZQNFW2KeQG0pNtPr08G46+ezBrgE+vGQAsir1hl38FWzoH7GNigDgs9 O7OY3v2Wba5S538g7IuFLF/G/zctcGIjkdXmrt4ztE0w8ws4ZB4U6k3lxOAgKiDE oGiPppgOVxLMahqThaxge06z6lXJU7Aue9E0JJY+3Qskq9yjr992lpbmEMv7FHmR Z9NYntEYpzbsnTPC0dOxq4k3Cz5GfwL7eg3hdnx0WZ5XmOlAk/EDF0RgXAYGJBqR u0EtCtBVni5zA+12rsCS6WiPjMoQAtq32qIlIyZKvMTPqQHr0Lrhi5mYRfIj2n4U lh5FE+WXadjxXjlsFh/gGo9yL7x+7n/rTsUbeUs6RAw4XLkNCK8DCSLXpNPVuoSN uA2ZqrJIskgYkgBFLIS3ZyyUYoXKL+gfAIdxbvZL8rjlZS+HnLC6IQ7W0pqChJEV sNSRyc4WRfEv2nlpDcZiF6R885AkcBdCv1YAgDgw62KTQm2gOjrZBWCAT4Jvqa/z
854680604e7bb82e8b989f4fa70125dbd485985e
abf65e3866e3278f99c1be3b25736cf8ee05b571
/include/my.h
20dd3ea237c29b5cfbcce2e4e552b57647467e4a
[]
no_license
Davphla/my_runner
c875e64d2613c3846b11afb86d34b933362f3627
4af14a452d7c9806dfd5f98472686ab0d4de0c1a
refs/heads/main
2023-06-16T03:49:57.012178
2021-07-17T20:25:43
2021-07-17T20:25:43
387,023,719
5
0
null
null
null
null
UTF-8
C
false
false
2,629
h
/* ** EPITECH PROJECT, 2020 ** my.h ** File description: ** all prototype */ #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <pwd.h> #include <grp.h> #define ABS(value) ((value > 0) ? (value) : (-value)) void my_putchar(char c); void my_putchar_error(char c); int my_isneg(int nb); int my_putnbr(int nb); void my_swap(int *a, int *b); int my_putstr(char const *str); int my_putstr_error(char const *str); int my_strlen(char const *str); int my_getnbr(char const *str); void my_sort_int_array(int *tab, int size); int my_compute_power_rec(int nb, int power); int my_compute_square_root(int nb); int my_is_prime(int nb); int my_find_prime_sup(int nb); char *my_strcpy(char *dest, char const *src); char *my_strncpy(char *dest, char const *src, int n); char *my_revstr(char *str); char *my_strstr(char *str, char const *to_find); int my_strcmp(char const *s1, char const *s2); int my_strncmp(char const *s1, char const *s2, int n); char *my_strupcase(char *str); char *my_strlowcase(char *str); char *my_strcapitalize(char *str); int my_str_isalpha(char const *str); int my_str_isnum(char const *str); int my_str_islower(char const *str); int my_str_isupper(char const *str); int my_str_isprintable(char const *str); int my_showstr(char const *str); int my_showmem(char const *str, int size); char *my_strcat(char *dest, char const *src); char *my_strncat(char *dest, char const *src, int nb); int my_is_pos(char const *str); int my_is_pos_getnbr(char const *str); int my_matrice_length(char **str); int my_show_word_array(char * const *tab); char *my_strdup(char const *src); char *my_alloc_char(int length, char char_wanted); int my_nbrcmp(char const *s1, char const *s2); char *my_alloc_char(int length, char char_wanted); char *my_nbr_to_str(int nb); char *my_add_char(char *src, int char_added, char character); char *my_add_last_char(char *src, int char_added, char character); char *my_slice_str(char *src, int n); void my_strswap(char **str, char **str_2); void my_megaputchar(char chara); void my_megaputstr(char *str, int n); int my_putnstr(char const *str, int n); void my_putnbr_base(unsigned int nbr, char const *base); int *my_alloc_int(int length, int int_wanted); int my_strnbr_cmp(char chara, char *str); void my_putnchar(char c, int n); int my_nbrlen(int nb); char *my_convertbase(unsigned int nbr, char const *base); char **my_add_last_str(char **src, char *str); int my_printf(char *str, ...); char **my_init_matrice(void); char *my_alloc_cat(char *str, char *str_added); void my_free(int nb_elements, ...);
0389f409c8e67eec7449bdaa3c274a214b13cf10
ad05055b3a326ee287ce924876c365787d1777ae
/TraceStore/TraceStoreTypes.c
a3a9140acad60bbb8a3e497b200a95ea27a222cc
[ "MIT" ]
permissive
iCodeIN/dictionary
aea26642e0663a994fddf5a4b05d07f2ba395df9
309b3731f79612f3e287c7ef2261f60e5c953704
refs/heads/master
2022-01-05T07:52:36.718365
2018-04-08T00:04:54
2018-04-08T00:04:54
null
0
0
null
null
null
null
UTF-8
C
false
false
3,907
c
/*++ Copyright (c) 2017 Trent Nelson <[email protected]> Module Name: TraceStoreTypes.c Abstract: This module exposes trace store and metadata store types. --*/ #include "stdafx.h" // // XXX: I have no idea where _PREFAST_ was defined by the time we hit this // point (StringTable and Python don't experience this complication), // nevertheless, if it's defined, UNREFERENCED_PARAMETER() bombs out // with linking errors. Explicitly undefine then redefine it here. // #ifdef UNREFERENCED_PARAMETER #undef UNREFERENCED_PARAMETER #endif #define UNREFERENCED_PARAMETER(P) (P) // // Define the trace store types owned by this module. // // // N.B. Keep these sorted alphabetically. In vim, mark the start and end brace // with ma and mb, then issue the command: // // :'a,'b !sort -b -k 2 // typedef struct _TRACE_STORE_TYPES { PRTL_BITMAP Bitmap; PLINKED_LINE DisplayTypeLines; PCHAR DisplayTypeText; PLINKED_LINE ExamineSymbolsLines; PCHAR ExamineSymbolsText; PTRACE_FUNCTION_TABLE FunctionTable; PTRACE_FUNCTION_TABLE_ENTRY FunctionTableEntry; PBYTE ImageFile; PSTRING Line; PTRACE_MODULE_LOAD_EVENT ModuleLoadEvent; PTRACE_MODULE_TABLE ModuleTable; PTRACE_MODULE_TABLE_ENTRY ModuleTableEntry; PPVOID Object; PTRACE_PAGE_FAULT PageFault; PTRACE_PERFORMANCE Performance; PTRACE_PERFORMANCE PerformanceDelta; PCHAR SourceCode; PSRCCODEINFOW SourceCodeInfo; PSOURCEFILEW SourceFile; PCHAR StringBuffer; PSYMBOL_INFO SymbolInfo; PTRACE_SYMBOL_TABLE SymbolTable; PTRACE_SYMBOL_TABLE_ENTRY SymbolTableEntry; PLINKED_LINE UnassembleFunctionLines; PCHAR UnassembleFunctionText; PWCHAR UnicodeStringBuffer; PTRACE_WS_WATCH_INFORMATION_EX WsWatchInfoEx; PPSAPI_WORKING_SET_EX_INFORMATION WsWorkingSetExInfo; } TRACE_STORE_TYPES; typedef TRACE_STORE_TYPES *PTRACE_STORE_TYPES; // // Define the trace store metadata types. // typedef struct _METADATA_STORE_TYPES { PTRACE_STORE_ADDRESS Address; PTRACE_STORE_ADDRESS_RANGE AddressRange; PTRACE_STORE_ALLOCATION Allocation; PTRACE_STORE_ALLOCATION_TIMESTAMP AllocationTimestamp; PTRACE_STORE_ALLOCATION_TIMESTAMP_DELTA AllocationTimestampDelta; PTRACE_STORE_INFO Info; PTRACE_STORE_METADATA_INFO MetadataInfo; PTRACE_STORE_RELOC Relocation; PTRACE_STORE_SYNC Synchronization; } METADATA_STORE_TYPES; typedef METADATA_STORE_TYPES *PMETADATA_STORE_TYPES; // // Define other notable module types that are useful to export. // typedef struct _MODULE_TYPES { PTRACE_CONTEXT TraceContext; PTRACE_DEBUG_CONTEXT TraceDebugContext; PTRACE_STORE TraceStore; PTRACE_STORE_MEMORY_MAP TraceStoreMemoryMap; PTRACE_STORE_METADATA_STORES TraceStoreMetadataStores; PTRACE_STORE TraceStores; PTRACE_SYMBOL_CONTEXT TraceSymbolContext; } MODULE_TYPES; typedef MODULE_TYPES *PMODULE_TYPES; // // Define notable function pointer types. // typedef struct _FUNCTION_TYPES { PALLOCATE_RECORDS AllocateRecords; PALLOCATE_RECORDS_WITH_TIMESTAMP AllocateRecordsWithTimestamp; PBIND_COMPLETE BindComplete; PTRY_ALLOCATE_RECORDS TryAllocateRecords; PTRY_ALLOCATE_RECORDS_WITH_TIMESTAMP TryAllocateRecordsWithTimestamp; } FUNCTION_TYPES; typedef FUNCTION_TYPES *PFUNCTION_TYPES; // // Type exposure functions. // DECLSPEC_DLLEXPORT VOID TraceStoreTypes( PTRACE_STORE_TYPES Types ) { UNREFERENCED_PARAMETER(Types); } DECLSPEC_DLLEXPORT VOID MetadataStoreTypes( PMETADATA_STORE_TYPES Types ) { UNREFERENCED_PARAMETER(Types); } DECLSPEC_DLLEXPORT VOID ModuleTypes( PMODULE_TYPES Types ) { UNREFERENCED_PARAMETER(Types); } DECLSPEC_DLLEXPORT VOID FunctionTypes( PFUNCTION_TYPES Types ) { UNREFERENCED_PARAMETER(Types); } // vim:set ts=8 sw=4 sts=4 tw=80 expandtab :
2f3e2d25636f2a6dbc78f446c72807f76da9c99a
664a14b0998a94c1c5f2695a66c6452aaf6c2c49
/malware_via_email/malware_0353/ia32_pe/by_hex-rays.c
688c2aa5d8d2112a3b2802f6a50b75ad3a67fa12
[]
no_license
xiaobo996/decompiler-subjects
2d8712a3ef0c031d2cf44b3e69ec8b03983cd366
d8d55ee11f095405aeb420fa982f260dd85b5831
refs/heads/master
2023-03-15T10:26:13.249349
2021-03-14T16:47:33
2021-03-14T16:47:33
null
0
0
null
null
null
null
UTF-8
C
false
false
1,292
c
/* This file was generated by the Hex-Rays decompiler. Copyright (c) 2007-2020 Hex-Rays <[email protected]> Detected compiler: Visual C++ */ #include <windows.h> #include <defs.h> //------------------------------------------------------------------------- // Function declarations // void __usercall start(char a1@<cf>, int a2@<eax>, int a3@<edx>); void __fastcall sub_4010AB(int a1, int a2); //----- (00401096) -------------------------------------------------------- void __usercall start(char a1@<cf>, int a2@<eax>, int a3@<edx>) { unsigned int v3; // [esp-8h] [ebp-8h] sub_4010AB(-(__CFADD__(a1, a2) | __CFADD__(a2, a1 + a2)), a3); __writefsdword(0, v3); JUMPOUT(0x4010B6); } // 4010C7: control flows out of bounds to 4010B6 // 4010A5: variable 'v3' is possibly undefined //----- (004010AB) -------------------------------------------------------- void __fastcall sub_4010AB(int a1, int a2) { struct _EXCEPTION_REGISTRATION_RECORD *v2; // [esp-4h] [ebp-4h] BYREF v2 = NtCurrentTeb()->NtTib.ExceptionList; __writefsdword(0, (unsigned int)&v2); MEMORY[0] = a2; JUMPOUT(0x4010B5); } // 4010B3: control flows out of bounds to 4010B5 // nfuncs=2 queued=2 decompiled=2 lumina nreq=0 worse=0 better=0 // ALL OK, 2 function(s) have been successfully decompiled
55eeb72c200f8d3ab5204eb11e3fa3113945ec58
36f8590a22685bb38020522f4051cbc136613d9c
/rEFIt_UEFI/PlatformPOSIX/include/Platform.h
d412c150e661b510b2a7abb85cb9e62c14f768af
[ "BSD-2-Clause" ]
permissive
onurcevk/CloverBootloader
040fc2446e42c8dcf93680b8f0e7ab2cbf9add08
afa09ccb4eb349f9a0d1cfbfbfde2d9b7a57b4eb
refs/heads/master
2023-04-09T22:24:25.084229
2021-04-23T14:54:59
2021-04-23T14:54:59
null
0
0
null
null
null
null
UTF-8
C
false
false
2,936
h
// // Platform.h.h // cpp_tests // // Created by jief on 23.02.20. // Copyright © 2020 Jief_Machak. All rights reserved. // #ifndef Platform_h_h #define Platform_h_h #ifndef _UINTPTR_T #define _UINTPTR_T // to prevent macOS/Clang definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft) #endif #ifndef _PTRDIFF_T_DECLARED #define _PTRDIFF_T_DECLARED // to prevent macOS/GCC definition of uintptr_t (map to a long). We prefer long long so we can use %llu on all platform (including microsoft) #endif #ifdef _MSC_VER #include <Windows.h> #endif //#pragma clang diagnostic ignored "-Wc99-extensions" #ifdef __cplusplus extern "C" { #endif #include <Uefi.h> #include <Base.h> #include <Library/BaseLib.h> #include <Library/BaseMemoryLib.h> #include <Library/MemoryAllocationLib.h> #include "../../../../rEFIt_UEFI/Platform/BootLog.h" //#include "BootLog.h" #include <Library/DebugLib.h> // this is just to define DEBUG, because Slice wrongly did some #ifdef DEBUG #ifdef __cplusplus } #endif #include <stdio.h> #include <limits.h> #include <stdarg.h> #include <stdint.h> #include <string.h> #include <inttypes.h> #include <wchar.h> #include "posix/posix.h" #include "../../../../rEFIt_UEFI/include/OneLinerMacros.h" #ifndef __cplusplus //typedef uint16_t wchar_t; typedef uint32_t char32_t; typedef uint16_t char16_t; typedef uint8_t bool; #endif // Replacement of uintptr_t to avoid warning in printf. It needs macro _UINTPTR_T to avoid to standard definition typedef unsigned long long uintptr_t; #undef PRIuPTR #define PRIuPTR "llu" //#define _UINTPTR_T #include "./posix/abort.h" #include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h" #ifdef __cplusplus #include "../../../rEFIt_UEFI/cpp_foundation/XString.h" #include "../../../rEFIt_UEFI/cpp_foundation/XArray.h" #include "../../../rEFIt_UEFI/cpp_foundation/XObjArray.h" #include "../include/remove_ref.h" #include "../cpp_lib/undefinable.h" #include "../include/OneLinerMacros.h" #include "../../../rEFIt_UEFI/entry_scan/common.h" #include "../../../rEFIt_UEFI/libeg/BmLib.h" #include "../Platform/BootLog.h" #include "../Platform/BasicIO.h" #include "../Platform/VersionString.h" #include "../Platform/Utils.h" #include "../../../rEFIt_UEFI/Platform/Utils.h" #endif #if defined(__clang__) // it works to include <Foundation/Foundation.h> and that allows to use NS... objects. Could be useful for a tool running on macOS. //#ifdef __OBJC__ //#define _MACH_H_ //#define __DEBUGGING__ //#import <Foundation/Foundation.h> //#undef CMASK //#endif #endif // to be able to compile AutoGen.c #ifdef __cplusplus extern "C" { #endif #include "../../Build/Clover/DEBUGMACOS_XCODE8/X64/rEFIt_UEFI/refit/DEBUG/AutoGen.h" EFI_STATUS EFIAPI RefitMain (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable); #ifdef __cplusplus } #endif #endif /* Platform_h_h */
9bea00c4e68509b5fafe8c2630653fc521c89433
bb51678ada8390040f9cb22682a3db67f0dbb939
/Source/smokeview/threader.c
353a52a8b04205456341835b9b6766d8adc514af
[ "NIST-Software" ]
permissive
solenick/smv
47a66252ac537d17e13ba04539cae8c22644b10a
6ec37d22fc8a2e4de106eca2bb0201dc7ead2440
refs/heads/master
2020-05-02T08:26:44.862873
2019-03-14T18:56:06
2019-03-14T18:56:06
177,843,162
1
0
NOASSERTION
2019-03-26T18:05:08
2019-03-26T18:05:08
null
UTF-8
C
false
false
5,544
c
#define INTHREADER #include "options.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include "smokeviewvars.h" #include "IOvolsmoke.h" /* ------------------ CompressSVZip2 ------------------------ */ void CompressSVZip2(void){ char shellcommand[1024]; PRINTF("Compressing...\n"); CompressOnOff(OFF); WriteIni(LOCAL_INI, NULL); // surround smokezip path name with "'s so that the system call can handle embedded blanks strcpy(shellcommand, "\""); strcat(shellcommand, smokezippath); strcat(shellcommand, "\" "); if(overwrite_all == 1){ strcat(shellcommand, " -f "); } if(erase_all == 1){ strcat(shellcommand, " -c "); } if(compress_autoloaded == 1){ strcat(shellcommand, " -auto "); } strcat(shellcommand, " "); strcat(shellcommand, smv_filename); PRINTF("Executing shell command: %s\n", shellcommand); system(shellcommand); UpdateSmoke3dMenuLabels(); UpdateBoundaryMenuLabels(); CompressOnOff(ON); updatemenu = 1; PRINTF("Compression completed\n"); } /* ------------------ InitMultiThreading ------------------------ */ void InitMultiThreading(void){ #ifdef pp_THREAD pthread_mutex_init(&mutexCOMPRESS,NULL); #ifdef pp_ISOTHREAD pthread_mutex_init(&mutexTRIANGLES,NULL); #endif pthread_mutex_init(&mutexVOLLOAD,NULL); #ifdef pp_THREADIBLANK pthread_mutex_init(&mutexIBLANK, NULL); #endif #endif } // *************** multi-threaded compression **************** #ifdef pp_THREAD /* ------------------ MtCompressSVZip ------------------------ */ void *MtCompressSVZip(void *arg){ LOCK_COMPRESS CompressSVZip2(); updatemenu=1; UNLOCK_COMPRESS pthread_exit(NULL); return NULL; } #endif /* ------------------ CompressSVZip ------------------------ */ #ifdef pp_THREAD void CompressSVZip(void){ pthread_create(&compress_thread_id,NULL, MtCompressSVZip,NULL); } #else void CompressSVZip(void){ CompressSVZip2(); } #endif /* ------------------ MtUpdateTriangles ------------------------ */ #ifdef pp_THREAD void *MtUpdateTriangles(void *arg){ UpdateTriangles(GEOM_DYNAMIC,GEOM_UPDATE_ALL); pthread_exit(NULL); return NULL; } /* ------------------ UpdateTrianglesMT ------------------------ */ void UpdateTrianglesMT(void){ if(iso_multithread==1){ pthread_create(&triangles_id, NULL, MtUpdateTriangles, NULL); } else{ UpdateTriangles(GEOM_DYNAMIC, GEOM_UPDATE_ALL); } } /* ------------------ FinishUpdateTriangles ------------------------ */ void FinishUpdateTriangles(void){ if(iso_multithread==1)pthread_join(triangles_id, NULL); } /* ------------------ CancelUpdateTriangles ------------------------ */ void CancelUpdateTriangles(void){ cancel_update_triangles = 1; FinishUpdateTriangles(); cancel_update_triangles = 0; } #else /* ------------------ UpdateTrianglesMT ------------------------ */ void UpdateTrianglesMT(void){ UpdateTriangles(GEOM_DYNAMIC,GEOM_UPDATE_ALL); } /* ------------------ CancelUpdateTriangles ------------------------ */ void CancelUpdateTriangles(void){ } /* ------------------ FinishUpdateTriangles ------------------------ */ void FinishUpdateTriangles(void){ } #endif // ************** multi threaded blank creation ********************** /* ------------------ MtMakeIBlank ------------------------ */ #ifdef pp_THREAD #ifdef pp_THREADIBLANK void *MtMakeIBlank(void *arg){ MakeIBlank(); SetCVentDirs(); LOCK_IBLANK update_setvents = 1; UNLOCK_IBLANK pthread_exit(NULL); return NULL; } #endif #endif /* ------------------ MtPSystem ------------------------ */ #ifdef pp_THREAD void *MtPSystem(void *arg){ char command_line[1024], moviefile_path[1024]; if(FILE_EXISTS(GetMovieFilePath(moviefile_path))==YES){ strcpy(command_line, "ffplay "); strcat(command_line, moviefile_path); #ifdef WIN32 strcat(command_line, " 2>Nul "); #else strcat(command_line, " 2>/dev/null "); #endif play_movie_now = 0; update_playmovie = 1; system(command_line); play_movie_now = 1; update_playmovie = 1; } pthread_exit(NULL); return NULL; } /* ------------------ PSystem ------------------------ */ void PSystem(char *commandline){ pthread_create(&system_thread_id, NULL, MtPSystem, NULL); } #else void PSystem(char *commandline){ system(commandline) } #endif /* ------------------ makeiblank_all ------------------------ */ #ifdef pp_THREAD #ifdef pp_THREADIBLANK void MakeIBlankAll(void){ pthread_create(&makeiblank_thread_id, NULL, MtMakeIBlank, NULL); } #else void MakeIBlankAll(void){ MakeIBlank(); SetCVentDirs(); update_setvents=1; } #endif #else void MakeIBlankAll(void){ MakeIBlank(); SetCVentDirs(); update_set_vents=1; } #endif /* ------------------ Update_Bounds ------------------------ */ int Update_Bounds(void){ UpdateAllBoundaryBounds(); #ifdef pp_THREAD pthread_join(update_all_patch_bounds_id,NULL); #endif return 1; } /* ------------------ UpdateAllBoundaryBoundsMT ------------------------ */ #ifdef pp_THREAD void *UpdateAllBoundaryBoundsMT(void *arg){ UpdateAllBoundaryBoundsST(); pthread_exit(NULL); return NULL; } void UpdateAllBoundaryBounds(void){ pthread_create(&update_all_patch_bounds_id,NULL, UpdateAllBoundaryBoundsMT,NULL); } #else void UpdateAllBoundaryBounds(void){ UpdateAllBoundaryBoundsST(); } #endif /* ------------------ MtReadVolsmokeAllFramesAllMeshes2 ------------------------ */ #ifdef pp_THREAD void MtReadVolsmokeAllFramesAllMeshes2(void){ pthread_create(&read_volsmoke_id,NULL,ReadVolsmokeAllFramesAllMeshes2,NULL); } #endif
97c0c123379d04a8da060fa2e582e94d2cc3e107
ecf37088c1618092ee847cb3bc656fdcf851fc48
/LibExt/LibExt_src/DevCamIPL/IPL_OV4689_OV9712_EVB_FF/IQS_SettingFunc_OV4689_OV9712_EVB_FF_Int.h
8845c2133297ed193426efb61337028ec5af6572
[]
no_license
calvinqiu/mygithub
b2ce14f0f6f1d3057517c16f109347d88b4a096d
b16780a2b34ba8e00af39b0fd9ccb4dacf1a0eee
refs/heads/master
2021-05-13T21:55:39.951529
2018-01-08T02:39:35
2018-01-08T02:39:35
116,472,710
0
0
null
null
null
null
UTF-8
C
false
false
574
h
#ifndef IQS_SETTINGFUNC_OV4689_OV9712_INT_H #define IQS_SETTINGFUNC_OV4689_OV9712_INT_H typedef enum { IQS_SIE_OBSUB, IQS_IFE_OBSUB } IQS_SUBOB_MODE; UINT32 IQS_IsCapFlow(IQS_FLOW_MSG MsgID); UINT32 IQS_OBSubMode(UINT32 Id, IQS_FLOW_MSG MsgID); UINT32 IQS_GetMSNRRepTime(UINT32 Id); UINT32 IQS_GetIFE2LcaTime(UINT32 Id, IQS_FLOW_MSG MsgID); UINT32 IQS_GetRetinexMinRatio(void); UINT32 IQS_GetChromaAdaptRatio(UINT32 Id, BOOL IsCap, BOOL GetMaxRatio); UINT32 IQS_IsChromaAdaptEn(UINT32 Id, BOOL IsCap); UINT32 IQS_Rst3DNRCounter(void); #endif //SENSOR_FLOW_FUNC_H
2551e3b64d15e8e3c6d8890dae8c00e5a92fcc02
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/ipc/extr_mqueue.c_mqueue_flush_file.c
78814d31a8b8b767c28e4c30677f4474b37b811e
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,211
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct mqueue_inode_info {scalar_t__ notify_owner; int /*<<< orphan*/ lock; } ; struct file {int dummy; } ; typedef int /*<<< orphan*/ fl_owner_t ; /* Variables and functions */ struct mqueue_inode_info* MQUEUE_I (int /*<<< orphan*/ ) ; int /*<<< orphan*/ current ; int /*<<< orphan*/ file_inode (struct file*) ; int /*<<< orphan*/ remove_notification (struct mqueue_inode_info*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; scalar_t__ task_tgid (int /*<<< orphan*/ ) ; __attribute__((used)) static int mqueue_flush_file(struct file *filp, fl_owner_t id) { struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); spin_lock(&info->lock); if (task_tgid(current) == info->notify_owner) remove_notification(info); spin_unlock(&info->lock); return 0; }
4941172ceb083051edd81e6cd5a5ea6061cb16b2
51635684d03e47ebad12b8872ff469b83f36aa52
/external/gcc-12.1.0/gcc/testsuite/gcc.target/i386/pr52698.c
8d8988fccc348a5d0af7cd02b400618756bffb47
[ "FSFAP", "LGPL-2.1-only", "LGPL-3.0-only", "GPL-3.0-only", "GPL-2.0-only", "GCC-exception-3.1", "LGPL-2.0-or-later", "Zlib", "LicenseRef-scancode-public-domain" ]
permissive
zhmu/ananas
8fb48ddfe3582f85ff39184fc7a3c58725fe731a
30850c1639f03bccbfb2f2b03361792cc8fae52e
refs/heads/master
2022-06-25T10:44:46.256604
2022-06-12T17:04:40
2022-06-12T17:04:40
30,108,381
59
8
Zlib
2021-09-26T17:30:30
2015-01-31T09:44:33
C
UTF-8
C
false
false
445
c
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O2 -mx32 -maddress-mode=long" } */ extern void abort (void); static __thread unsigned char foo [32] __attribute__ ((tls_model ("initial-exec"), aligned (sizeof (void *)))); void test2 (void) { unsigned int s; for (s = 0; s < sizeof (foo); ++s) { if (foo [s] != s) abort (); foo [s] = sizeof (foo) - s; } }
ac70f0a489c9eb550389f838b64be8878e53fb85
ea4e3ac0966fe7b69f42eaa5a32980caa2248957
/download/unzip/configd/configd-42/SystemConfiguration.fproj/SCDPrivate.c
8e0b6ba4141e903558389ce7ad67e6aa91b1003c
[]
no_license
hyl946/opensource_apple
36b49deda8b2f241437ed45113d624ad45aa6d5f
e0f41fa0d9d535d57bfe56a264b4b27b8f93d86a
refs/heads/master
2023-02-26T16:27:25.343636
2020-03-29T08:50:45
2020-03-29T08:50:45
249,169,732
0
0
null
null
null
null
UTF-8
C
false
false
4,559
c
/* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * Modification History * * June 1, 2001 Allan Nathanson <[email protected]> * - public API conversion * * November 9, 2000 Allan Nathanson <[email protected]> * - initial revision */ #include <SystemConfiguration/SystemConfiguration.h> #include <SystemConfiguration/SCPrivate.h> #include <mach/mach.h> #include <mach/notify.h> #include <mach/mach_error.h> #include <pthread.h> void __showMachPortStatus() { #ifdef DEBUG /* print status of in-use mach ports */ if (_sc_debug) { kern_return_t status; mach_port_name_array_t ports; mach_port_type_array_t types; int pi, pn, tn; CFMutableStringRef str; SCLog(_sc_verbose, LOG_DEBUG, CFSTR("----------")); /* report on ALL mach ports associated with this task */ status = mach_port_names(mach_task_self(), &ports, &pn, &types, &tn); if (status == MACH_MSG_SUCCESS) { str = CFStringCreateMutable(NULL, 0); for (pi=0; pi < pn; pi++) { char rights[16], *rp = &rights[0]; if (types[pi] != MACH_PORT_TYPE_NONE) { *rp++ = ' '; *rp++ = '('; if (types[pi] & MACH_PORT_TYPE_SEND) *rp++ = 'S'; if (types[pi] & MACH_PORT_TYPE_RECEIVE) *rp++ = 'R'; if (types[pi] & MACH_PORT_TYPE_SEND_ONCE) *rp++ = 'O'; if (types[pi] & MACH_PORT_TYPE_PORT_SET) *rp++ = 'P'; if (types[pi] & MACH_PORT_TYPE_DEAD_NAME) *rp++ = 'D'; *rp++ = ')'; } *rp = '\0'; CFStringAppendFormat(str, NULL, CFSTR(" %d%s"), ports[pi], rights); } SCLog(_sc_verbose, LOG_DEBUG, CFSTR("Task ports (n=%d):%@"), pn, str); CFRelease(str); } else { /* log (but ignore) errors */ SCLog(_sc_verbose, LOG_DEBUG, CFSTR("mach_port_names(): %s"), mach_error_string(status)); } } #endif /* DEBUG */ return; } void __showMachPortReferences(mach_port_t port) { #ifdef DEBUG kern_return_t status; mach_port_urefs_t refs_send = 0; mach_port_urefs_t refs_recv = 0; mach_port_urefs_t refs_once = 0; mach_port_urefs_t refs_pset = 0; mach_port_urefs_t refs_dead = 0; SCLog(_sc_verbose, LOG_DEBUG, CFSTR("user references for mach port %d"), port); status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, &refs_send); if (status != KERN_SUCCESS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_SEND): %s"), mach_error_string(status)); return; } status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, &refs_recv); if (status != KERN_SUCCESS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_RECEIVE): %s"), mach_error_string(status)); return; } status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND_ONCE, &refs_once); if (status != KERN_SUCCESS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_SEND_ONCE): %s"), mach_error_string(status)); return; } status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_PORT_SET, &refs_pset); if (status != KERN_SUCCESS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_PORT_SET): %s"), mach_error_string(status)); return; } status = mach_port_get_refs(mach_task_self(), port, MACH_PORT_RIGHT_DEAD_NAME, &refs_dead); if (status != KERN_SUCCESS) { SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" mach_port_get_refs(MACH_PORT_RIGHT_DEAD_NAME): %s"), mach_error_string(status)); return; } SCLog(_sc_verbose, LOG_DEBUG, CFSTR(" send = %d, receive = %d, send once = %d, port set = %d, dead name = %d"), refs_send, refs_recv, refs_once, refs_pset, refs_dead); #endif /* DEBUG */ return; }
c1ad275f2f5010080b45df7f69320dbe2eb07680
acb8d4c4f974d872f31997f591fea4d748f94b93
/d/qilian/npc/xlama2.c
2797387cfd8ae7f1aab1bc70faa6f4b7e0a9a548
[]
no_license
MudRen/SZMUD
8ae6b05718b1a83363478469185e0d776b0fda5c
e3b46e6efa6d353f7f0d00ef676f97d5c0ec3949
refs/heads/master
2023-05-27T16:04:35.845610
2021-06-18T12:47:19
2021-06-18T12:47:19
361,736,744
1
2
null
null
null
null
GB18030
C
false
false
1,674
c
// Code of ShenZhou // Summer 9/26/1996. inherit NPC; int ask_tea(); void create() { set_name("小喇嘛", ({ "xiao lama", "xiao", "lama" })); set("long", "这是烧茶的小喇嘛,他身穿黄色袈裟,左手拿着个大茶勺, \n" "正汗流满面地跟茶锅前忙乎。\n"); set("gender", "男性"); set("age", 20); set("attitude", "peaceful"); set("class","bonze"); set("shen_type", 1); set("str", 22); set("int", 20); set("con", 22); set("dex", 21); set("max_qi", 300); set("max_jing", 300); set("neili", 100); set("max_neili", 100); set("jiali", 10); set("combat_exp", 1000); set_skill("force", 20); set_skill("dodge", 25); set_skill("parry", 20); set_skill("strike", 20); set("inquiry", ([ "酥油茶" : (: ask_tea :), ])); setup(); carry_object(__DIR__"obj/lamajiasha")->wear(); } int ask_tea() { say("小喇嘛一脸不耐烦:酥油那麽贵,想喝茶那能说有就有,等着! \n"); this_player()->set_temp("marks/茶", 1); return 1; } int accept_object(object who, object ob) { object tea; if (ob->name()!="酥油") { write("小喇嘛笑得合不拢嘴:佛主保佑" + RANK_D->query_respect(who)+ "。\n"); return 1; } write( "小喇嘛点头哈腰:佛主保佑" + RANK_D->query_respect(who)+" ,请用茶。\n"); who->delete_temp("marks/茶"); tea=new("/d/qilian/obj/buttertea"); tea->move("/d/qilian/chufang"); tea=new("/d/qilian/obj/buttertea"); tea->move("/d/qilian/chufang"); tea=new("/d/qilian/obj/buttertea"); tea->move("/d/qilian/chufang"); return 1; } void destroy (object ob) { destruct(ob); }
61deee2157ad554a03c46ea0528d730f2aae2ee1
c2ce9da9c0c7edbbe722466d747aeb1eb646b435
/test_roms/tonc/code/basic/key_demo/toolbox.c
fd5ff3437a0ced60613a1469e05207d5cad8f45e
[ "MIT" ]
permissive
daniel5151/gba-rs
63d3a374352c99b7f0826691953d5cfbaed4a73e
643e065f82cf8c51507ee4610ef86ba168cbe41b
refs/heads/master
2020-07-29T15:11:15.540653
2019-09-02T02:24:35
2019-09-02T02:24:35
209,857,128
0
0
MIT
2019-09-20T18:33:03
2019-09-20T18:33:02
null
UTF-8
C
false
false
426
c
// // toolbox.c // // Tools source for key_demo // // (20060922-20060922, cearn) // // === NOTES === // * This is a _small_ set of typedefs, #defines and inlines that can // be found in tonclib, and might not represent the // final forms. #include "toolbox.h" // === (tonc_core.c) ================================================== u16 __key_curr= 0, __key_prev= 0; COLOR *vid_page= vid_mem_back;
6d995a83fee55076272a09af29df81f23e6d8542
a1a3c01055d09ad0254fee19dc823c0cb31e032e
/src/string/ft_strncat.c
fe14e264c41af183bb999e8f4eb38e005451760e
[]
no_license
justas05/liblc
77aee65fb77b068affaa1f105ac5bbf6741c15a1
fb42c160a9e4354f44a8730dfcc1ec288db7d7bc
refs/heads/master
2023-02-11T18:15:31.265171
2021-01-12T19:49:10
2021-01-12T19:49:10
329,039,006
1
0
null
null
null
null
UTF-8
C
false
false
1,112
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncat.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hbooke <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/10/29 02:41:30 by hbooke #+# #+# */ /* Updated: 2020/10/29 02:41:30 by hbooke ### ########.fr */ /* */ /* ************************************************************************** */ #include <stddef.h> char *ft_strncat(char *dest, const char *src, size_t n) { char *dest_copy; dest_copy = dest; while (*dest) ++dest; while (n-- && (*dest = *src++)) ++dest; *dest = 0; return (dest_copy); }
9f60d5cddba659960c37c1760998650a248bde39
e8302c75d770d1608b317d6af5c483bbad6c0493
/include/zephyr/arch/arm64/cache.h
a4a155bdde73840a2f3b01cfe995a6d02101805c
[ "Apache-2.0" ]
permissive
intel/zephyr
819362089aa44ae378a5558f3b222197aaa811f7
06d5bc51b580777079bb0b7e769e4127598ea5ee
refs/heads/main
2023-09-04T00:20:35.217393
2023-02-16T11:27:40
2023-02-16T14:59:16
65,052,293
32
32
Apache-2.0
2022-04-05T17:14:07
2016-08-05T22:14:50
C
UTF-8
C
false
false
2,313
h
/* * Copyright 2022 Carlo Caione <[email protected]> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_ARCH_ARM64_CACHE_H_ #define ZEPHYR_INCLUDE_ARCH_ARM64_CACHE_H_ #ifndef _ASMLANGUAGE #include <zephyr/types.h> #include <zephyr/sys/util.h> #include <zephyr/arch/cpu.h> #include <errno.h> #ifdef __cplusplus extern "C" { #endif #define K_CACHE_WB BIT(0) #define K_CACHE_INVD BIT(1) #define K_CACHE_WB_INVD (K_CACHE_WB | K_CACHE_INVD) #if defined(CONFIG_DCACHE) extern int arm64_dcache_range(void *addr, size_t size, int op); extern int arm64_dcache_all(int op); extern size_t arch_dcache_line_size_get(void); int ALWAYS_INLINE arch_dcache_flush_all(void) { return arm64_dcache_all(K_CACHE_WB); } int ALWAYS_INLINE arch_dcache_invd_all(void) { return arm64_dcache_all(K_CACHE_INVD); } int ALWAYS_INLINE arch_dcache_flush_and_invd_all(void) { return arm64_dcache_all(K_CACHE_WB_INVD); } int ALWAYS_INLINE arch_dcache_flush_range(void *addr, size_t size) { return arm64_dcache_range(addr, size, K_CACHE_WB); } int ALWAYS_INLINE arch_dcache_invd_range(void *addr, size_t size) { return arm64_dcache_range(addr, size, K_CACHE_INVD); } int ALWAYS_INLINE arch_dcache_flush_and_invd_range(void *addr, size_t size) { return arm64_dcache_range(addr, size, K_CACHE_WB_INVD); } void ALWAYS_INLINE arch_dcache_enable(void) { /* nothing */ } void ALWAYS_INLINE arch_dcache_disable(void) { /* nothing */ } #endif /* CONFIG_DCACHE */ #if defined(CONFIG_ICACHE) size_t arch_icache_line_size_get(void) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_flush_all(void) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_invd_all(void) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_flush_and_invd_all(void) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_flush_range(void *addr, size_t size) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_invd_range(void *addr, size_t size) { return -ENOTSUP; } int ALWAYS_INLINE arch_icache_flush_and_invd_range(void *addr, size_t size) { return -ENOTSUP; } void ALWAYS_INLINE arch_icache_enable(void) { /* nothing */ } void ALWAYS_INLINE arch_icache_disable(void) { /* nothing */ } #endif /* CONFIG_ICACHE */ #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_CACHE_H_ */ #ifdef __cplusplus } #endif #endif /* _ASMLANGUAGE */
ea2b021b5991f65e4b8ad387c243ee15da44a3c5
cbc35abd7528ce93937d3df9e6ec1f47ac078738
/old/嵌入式/uCOS_uCGUI-2014/S3C2440/include/Def1.h
9266ad762ddcc9bb5872e50b1a2a80d005c3d76f
[]
no_license
InnoMachine/JuniorYear_Notes
52fff6e01bf0a4a06bc12910b23d6bace6eca882
f8f1a8a05a364e6fff2bd4bea86c6ce3aa767be8
refs/heads/master
2021-01-23T08:52:45.189638
2015-09-17T13:15:48
2015-09-17T13:15:48
42,172,090
4
2
null
null
null
null
UTF-8
C
false
false
313
h
#ifndef __DEF_H__H #define __DEF_H__H #include "LCD.h" //#define U32 unsigned int //#define U16 unsigned short #define S32 int #define S16 short int #define U8 unsigned char #define S8 char #define TRUE 1 #define FALSE 0 #define OK 1 #define FAIL 0 #define ESC_KEY ('q') // 0x1b #endif /*__DEF_H__*/
19902c4c9893d29568d967645cacab7b44f0e280
7901e09d4f0827e0590fa6a7f038e7d9363e903b
/c_primer_plus/ch16/qsorter.c
76ab402763b27b6c2ccb8ecea1b868e5e38d208c
[]
no_license
jiesoul/c_cpp_learn
32298fa21d159d3fc9a6c0c2711700548db9e4a2
cd4e411f73222dd26d22c1110ce0af4ecc60f051
refs/heads/main
2023-03-16T15:54:54.553175
2022-06-14T05:30:51
2022-06-14T05:30:51
204,853,153
0
0
null
null
null
null
UTF-8
C
false
false
1,028
c
#include <stdio.h> #include <stdlib.h> #define NUM 40 void fillarray(double ar [], int n); void showarray(const double ar[], int n); int mycomp(const void * p1, const void * p2); int main(void) { double vals[NUM]; fillarray(vals, NUM); puts("Random list:"); showarray(vals, NUM); qsort(vals, NUM, sizeof(double), mycomp); puts("\nSorted list:"); showarray(vals, NUM); return 0; } void fillarray(double ar [], int n) { int index; for (index = 0; index < n; index++) { ar[index] = (double) rand() / ((double) rand() + 0.1); } } void showarray(const double ar [], int n) { int index; for (index = 0; index < n; index++) { printf("%9.4f ", ar[index]); if (index % 6 == 5) { putchar('\n'); } } if (index % 6 != 0) { putchar('\n'); } } int mycomp(const void *p1, const void *p2) { const double * a1 = (const double *) p1; const double * a2 = (const double *) p2; if (*a1 < *a2) { return -1; } else if (*a1 == *a2) { return 0; } else { return 1; } }
2fd9a1f1524386763e78141b16ff167748701bff
e913543c4a727a37e5e96c7bb1be0d69e1a5b213
/BSP/STM32F1xxxx/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_can_ex.h
df028ce7401bebc3c75230c03ce7627857e7d0cd
[]
no_license
michprev/Drone_DEPRECATED
5d8f49a3d3dcde7553d875e1964c6af61854e5a2
4ffeeaa994e4fff633200a85ef3c5f38cdf56c4d
refs/heads/master
2021-04-30T18:33:56.714121
2017-01-31T16:40:10
2017-01-31T16:40:10
60,986,274
1
1
null
null
null
null
UTF-8
C
false
false
6,811
h
/** ****************************************************************************** * @file stm32f1xx_hal_can_ex.h * @author MCD Application Team * @version V1.0.2 * @date 18-December-2015 * @brief Header file of CAN HAL Extension module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F1xx_HAL_CAN_EX_H #define __STM32F1xx_HAL_CAN_EX_H #ifdef __cplusplus extern "C" { #endif #if defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || \ defined(STM32F103xG) || defined(STM32F105xC) || defined(STM32F107xC) /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal_def.h" /** @addtogroup STM32F1xx_HAL_Driver * @{ */ /** @defgroup CANEx CANEx * @{ */ /* Exported types ------------------------------------------------------------*/ /** * @brief CAN filter configuration structure definition */ /* CAN filter banks differences over STM32F1 devices: */ /* - STM32F1 Connectivity line: 28 filter banks shared between CAN1 and CAN2 */ /* - Other STM32F10x devices: 14 filter banks */ typedef struct { uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, according to the mode (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, according to the mode (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1) which will be assigned to the filter. This parameter can be a value of @ref CAN_filter_FIFO */ #if defined(STM32F105xC) || defined(STM32F107xC) uint32_t FilterNumber; /*!< Specifies the filter which will be initialized. This parameter must be a number between Min_Data = 0 and Max_Data = 27. */ #else uint32_t FilterNumber; /*!< Specifies the filter which will be initialized. This parameter must be a number between Min_Data = 0 and Max_Data = 13. */ #endif /* STM32F105xC || STM32F107xC */ uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. This parameter can be a value of @ref CAN_filter_mode */ uint32_t FilterScale; /*!< Specifies the filter scale. This parameter can be a value of @ref CAN_filter_scale */ uint32_t FilterActivation; /*!< Enable or disable the filter. This parameter can be set to ENABLE or DISABLE. */ uint32_t BankNumber; /*!< Select the start slave bank filter This parameter must be a number between Min_Data = 0 and Max_Data = 28. */ }CAN_FilterConfTypeDef; /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /** @defgroup CANEx_Private_Macros CAN Extended Private Macros * @{ */ #if defined(STM32F105xC) || defined(STM32F107xC) #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 27) #else #define IS_CAN_FILTER_NUMBER(NUMBER) ((NUMBER) <= 13) #endif /* STM32F105xC || STM32F107xC */ /** * @} */ /** * @} */ /** * @} */ #endif /* STM32F103x6) || STM32F103xB || STM32F103xE || */ /* STM32F103xG) || STM32F105xC || STM32F107xC */ #ifdef __cplusplus } #endif #endif /* __STM32F1xx_HAL_CAN_EX_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
65e1d2de646d868cc87d2c399f7c02e233b699ed
93032b0c117327b896d178f6be5776418799bfca
/3/module/stopwatch.h
03b3362a592606d61877eb99908cb0c1b0c55f84
[]
no_license
KOREAN139/CSE4116
3036e654695da87479f58fd0415b83654d03b60e
fdafaf5691cf915ed53eb850e9de8f9fbbe10ac0
refs/heads/master
2020-05-09T13:31:36.540533
2019-06-21T07:42:32
2019-06-21T07:42:32
181,155,079
0
0
null
null
null
null
UTF-8
C
false
false
213
h
/* * Copyright (c) 2019 Sanggu Han */ #ifndef _STOPWATCH_H_ #define _STOPWATCH_H_ #define DEVICE_NAME "/dev/stopwatch" #define MAJOR_NUM 242 #define SUCCESS 0 #define FND_ADDRESS 0x08000004 #endif
76b8d770a83959cd3812771f92d8faa2a5bf1fef
4800c4b9e91ed202e36014d85e6999b773f0f162
/vmm/src/control/ctrl.c
3879f6ad95f2bea9eff7932082f25175282a53e3
[]
no_license
zhangbonian/ramooflax
91f94e48b0ad70e0f40c758c41828bae950bc681
da962835c30f19c682ddec2cc96fe8ce56829042
refs/heads/master
2021-01-22T13:13:15.991946
2012-01-13T12:33:08
2012-01-13T12:33:08
null
0
0
null
null
null
null
UTF-8
C
false
false
3,154
c
/* ** Copyright (C) 2011 EADS France, stephane duverger <[email protected]> ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program 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 General Public License for more details. ** ** You should have received a copy of the GNU General Public License along ** with this program; if not, write to the Free Software Foundation, Inc., ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <ctrl.h> #include <insn.h> #include <excp.h> #include <debug.h> #include <emulate.h> #include <info_data.h> extern info_data_t *info; static void ctrl_traps_enable() { debug(CTRL, "ctrl traps enable\n"); if(dbg_hard_stp_enabled()) dbg_hard_stp_setup_context(); dbg_soft_rearm(); dbg_hard_brk_rearm(); __update_exception_mask(); ctrl_set_traps(1); ctrl_traps_set_update(0); } static void ctrl_traps_disable() { debug(CTRL, "ctrl traps disable\n"); if(dbg_hard_stp_enabled()) dbg_hard_stp_restore_context(); if(!dbg_soft_disarmed()) dbg_soft_disarm(); dbg_hard_brk_disarm(); __exception_bitmap.raw = info->vm.cpu.dflt_excp; __post_access(__exception_bitmap); ctrl_set_traps(0); ctrl_traps_set_update(0); } static void ctrl_traps() { if(__ctrl_active_cr3_check(0)) { if(!ctrl_traps_enabled() || ctrl_traps_updated()) ctrl_traps_enable(); } else if(ctrl_traps_enabled() || ctrl_traps_updated()) ctrl_traps_disable(); } int __ctrl_active_cr3_check(int rpl) { if(!ctrl_cr3_enabled()) return 1; if(__cpl < rpl) return 0; if(_xx_lmode()) return (__cr3.pml4.addr == info->vmm.ctrl.stored_cr3.pml4.addr); else if(__cr4.pae) return (__cr3.pae.addr == info->vmm.ctrl.stored_cr3.pae.addr); else return (__cr3.addr == info->vmm.ctrl.stored_cr3.addr); return 0; } void ctrl_active_cr3_enable(raw64_t cr3) { info->vmm.ctrl.stored_cr3.raw = cr3.raw; info->vmm.ctrl.active_cr3 = &info->vmm.ctrl.stored_cr3; ctrl_set_cr3(1); debug(CTRL, "active cr3: 0x%X (0x%X <=> 0x%X)\n" , info->vmm.ctrl.stored_cr3.raw , info->vmm.ctrl.active_cr3 ,&info->vmm.ctrl.stored_cr3); } void ctrl_active_cr3_disable() { info->vmm.ctrl.active_cr3 = &__cr3; ctrl_set_cr3_keep(0); ctrl_set_cr3(0); } void ctrl_active_cr3_reset() { if(!ctrl_cr3_keep()) ctrl_active_cr3_disable(); } void ctrl_usr_reset() { info->vmm.ctrl.usr.excp = 0; __update_exception_mask(); ctrl_usr_set_cr_rd(0); ctrl_usr_set_cr_wr(0); __disable_lbr(); debug(CTRL, "ctrl user filters disabled\n"); } void controller() { if(ctrl_active_cr3_check()) ctrl_event(); #ifdef CONFIG_GDBSTUB gdbstub(); #endif if(dbg_hard_dr6_dirty()) dbg_hard_dr6_clean(); ctrl_traps(); }
446a98a1a929dfaaae773ea12b9501c5adc6b116
3d4c4fcfe965fef78d2561dafe28c4b61c4cdf28
/za/plugin/config.c
d1d0764b696ca1b9107590fe23c032f3889dd55a
[]
no_license
cinderelladlw/billwawa
206dbf090376d820c079991687ef5852128b20e3
9bed36e73308ef7f63b13b8ffcc092c32c26863f
refs/heads/master
2018-12-28T04:20:14.922224
2014-12-02T14:10:17
2014-12-02T14:10:17
5,884,487
1
0
null
null
null
null
UTF-8
C
false
false
1,607
c
#include "config.h" static int sb = 0; static int callback(void *NotUsed, int a, char **ar, char **azColName){ int i; for(i=0; i<a; i++){ printf("%s = %s\n", azColName[i], ar[i] ? ar[i] : "NULL"); if(i == 0) { strcpy(sxx[sb].dllname, ar[i]?ar[i]:"NULL"); } else { strcpy(sxx[sb].funcname, ar[i]?ar[i]:"NULL"); sb++; } } return 0; } static int committransaction(char *commitsql, int commitnumber) { rc = sqlite3_exec(db, "begin immediate", 0, 0, &zErrMsg); for(i = 0; i < commitnumber; i++) { rc = sqlite3_exec(db, commitsql, callback, 0, &zErrMsg); if( rc!=SQLITE_OK ){ fprintf(stderr, "SQL error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } } rc = sqlite3_exec(db, "commit", 0, 0, &zErrMsg); } int readconfig() { rc = sqlite3_open("mbs.db", &db); if (rc) { fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); sqlite3_close(db); return -1; } committransaction("select * from config", 1); sqlite3_close(db); return sb; } /* int main() { readconfig(); return 0; } int main(int argc, char **argv) { int j = atoi(argv[3]); int k = atoi(argv[4]); if( argc != 5 ){ fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT TIMES transactionsize \n", argv[0]); return(1); } rc = sqlite3_open(argv[1], &db); if( rc ){ fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); sqlite3_close(db); return(1); } while(j >= k) { committransaction(argv[2], k); j = j - k; } committransaction(argv[2], j); sqlite3_close(db); return 0; } */
[ "bill@ubuntu.(none)" ]
bill@ubuntu.(none)
1821b22ad1779de0e5368474b96b75068f1d1889
c2cedcf36667730f558ab354bea4505b616c90d2
/players/rich/edfile1.c
8414a2ec87957ef7f6dfafc9351f312bd4c10028
[]
no_license
wugouzi/Nirvlp312mudlib
965ed876c7080ab00e28c5d8cd5ea9fc9e46258f
616cad7472279cc97c9693f893940f5336916ff8
refs/heads/master
2023-03-16T03:45:05.510851
2017-09-21T17:05:00
2017-09-21T17:05:00
null
0
0
null
null
null
null
UTF-8
C
false
false
2,101
c
int i, charges; object targetloc; id(str) { return str == "amulet"; } reset(arg) { if (!arg) charges=random(6); } long() { write("A small magical amulet is here.\n"); if (i == 1) { write("Looking into the amulet you see:\n"); call_other(targetloc,"long"); } } short() { return "A small magical amulet"; } query_value() { return 100; } init() { add_action("use","use"); add_action("set","set"); add_action("stat","stat"); } use(arg) { string realm, destrealm; if (!id(arg)) { return 0; } else { realm=call_other(environment(this_player()),"realm",0); destrealm=call_other(targetloc,"realm",0); if ((realm == destrealm) && (realm != "NT")) { write("As you use the amulet everything shimmers away...\n"); say(call_other(this_player(),"query_name") + " shimmers and fades.\n"); move_object(this_player(), targetloc); say(call_other(this_player(),"query_name") + " shimmers into solidity.\n"); call_other(this_player(),"look",0); if (charges == 1) { move_object(this_object(), "players/rich/workroom"); write("The amulet did not make it through the transport.\n"); call_other(this_player(),"add_weight", -1); } charges=charges-1; } else { write("The amulet struggles to take you with it, but fails.\n"); move_object(this_object(), targetloc); write("The amulet shimmers and fades!\n"); call_other(this_player(),"add_weight", -1); } return 1; } } set(arg) { targetloc = "players/rich/lower/atrans.c" } get() { return 1; } query_weight() { return 1; } stat(arg) { if (!arg || arg!="amulet" || call_other(this_player(),"query_level",0)<20) return 0; write("Amulet stats:\ncharges:"); write(charges); write("\ndestination:"); write(targetloc); write("\n"); }
7e3bc77e8bc717d5c7607daee177d3058ff45806
7e41167bfae6d2c38689b7e0993b308e045cbd05
/curl/curl/docs/examples/threaded-ssl.c
5f1d9b924674e20101cdc0a784c7b5bd4c5a0d76
[ "GPL-1.0-or-later", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-proprietary-license", "LGPL-2.0-or-later", "BSD-3-Clause", "BSD-4-Clause", "MIT", "curl", "Python-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
holzschu/ios_system
7b18993dbcb33331c353e0257ca54847a5d1b1bb
6a83eb1c6c383a562fbe33a7e97677e88d305b51
refs/heads/master
2023-08-14T09:11:40.627903
2023-04-18T15:12:29
2023-04-18T15:12:29
113,187,304
882
155
BSD-3-Clause
2023-08-19T19:15:35
2017-12-05T13:42:50
C
UTF-8
C
false
false
4,422
c
/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2016, Daniel Stenberg, <[email protected]>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* <DESC> * Show the required mutex callback setups for GnuTLS and OpenSSL when using * libcurl multi-threaded. * </DESC> */ /* A multi-threaded example that uses pthreads and fetches 4 remote files at * once over HTTPS. The lock callbacks and stuff assume OpenSSL or GnuTLS * (libgcrypt) so far. * * OpenSSL docs for this: * https://www.openssl.org/docs/crypto/threads.html * gcrypt docs for this: * https://gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html */ #define USE_OPENSSL /* or USE_GNUTLS accordingly */ #include <stdio.h> #include <pthread.h> #include <curl/curl.h> #define NUMT 4 /* we have this global to let the callback get easy access to it */ static pthread_mutex_t *lockarray; #ifdef USE_OPENSSL #include <openssl/crypto.h> static void lock_callback(int mode, int type, char *file, int line) { (void)file; (void)line; if(mode & CRYPTO_LOCK) { pthread_mutex_lock(&(lockarray[type])); } else { pthread_mutex_unlock(&(lockarray[type])); } } static unsigned long thread_id(void) { unsigned long ret; ret=(unsigned long)pthread_self(); return ret; } static void init_locks(void) { int i; lockarray=(pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); for(i=0; i<CRYPTO_num_locks(); i++) { pthread_mutex_init(&(lockarray[i]), NULL); } CRYPTO_set_id_callback((unsigned long (*)())thread_id); CRYPTO_set_locking_callback((void (*)())lock_callback); } static void kill_locks(void) { int i; CRYPTO_set_locking_callback(NULL); for(i=0; i<CRYPTO_num_locks(); i++) pthread_mutex_destroy(&(lockarray[i])); OPENSSL_free(lockarray); } #endif #ifdef USE_GNUTLS #include <gcrypt.h> #include <errno.h> GCRY_THREAD_OPTION_PTHREAD_IMPL; void init_locks(void) { gcry_control(GCRYCTL_SET_THREAD_CBS); } #define kill_locks() #endif /* List of URLs to fetch.*/ const char * const urls[]= { "https://www.example.com/", "https://www2.example.com/", "https://www3.example.com/", "https://www4.example.com/", }; static void *pull_one_url(void *url) { CURL *curl; curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, url); /* this example doesn't verify the server's certificate, which means we might be downloading stuff from an impostor */ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_perform(curl); /* ignores error */ curl_easy_cleanup(curl); return NULL; } int main(int argc, char **argv) { pthread_t tid[NUMT]; int i; int error; (void)argc; /* we don't use any arguments in this example */ (void)argv; /* Must initialize libcurl before any threads are started */ curl_global_init(CURL_GLOBAL_ALL); init_locks(); for(i=0; i< NUMT; i++) { error = pthread_create(&tid[i], NULL, /* default attributes please */ pull_one_url, (void *)urls[i]); if(0 != error) fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); else fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); } /* now wait for all threads to terminate */ for(i=0; i< NUMT; i++) { error = pthread_join(tid[i], NULL); fprintf(stderr, "Thread %d terminated\n", i); } kill_locks(); return 0; }
7342a189092d2a383d20a0ba9131ee9a42cf4639
dcf26a6bcf853a3f8f6f50f9379998ef4d8aad40
/third_party/musl/src/malloc/expand_heap.c
90d3fef5d57b5050b064e80dec5b6395bf2a498b
[]
no_license
small-seven/testmem
c5f3202dce1c369e9d84cdaaccc2008b827c16d8
2771460c617439bd1be562ffdc94543ea170a736
refs/heads/main
2023-03-12T22:16:28.824577
2021-03-03T04:24:59
2021-03-03T04:24:59
343,847,762
1
0
null
null
null
null
UTF-8
C
false
false
145
c
#include <limits.h> #include <stdint.h> #include <errno.h> #include <sys/mman.h> #include "libc.h" #include "syscall.h" #include "malloc_impl.h"
e52b31d2046cb4f4153d19245dfe8d13ba5e8f27
e2cd7ff00b734d3db553620c01f46b91a11290a9
/Anisul islam/Control Stratement/loop/serise/new.c
a0fd3449b8c7c5746473dbb2cd6e5f932b475f81
[]
no_license
Al-Imran5150/Basic-c-Programming
e8485e2b7437180de373032c803fd64292c1b7df
774a65a6c7d9d95d2a8b6461ddb3d66ce06236b4
refs/heads/main
2023-07-17T22:59:51.887519
2021-09-04T18:42:36
2021-09-04T18:42:36
403,110,887
1
0
null
null
null
null
UTF-8
C
false
false
238
c
#include<stdio.h> int main() { int i,n,sum=0; printf("Type your value = "); scanf("%d",&n); printf("1+2+3+............+%d ",n); for (i=1; i<=n; i=i+1) { sum =sum+i; } printf("Your Result = %d",sum); }
e8ef61717800ab891cf7065917702c0b431f41bb
c05f9f6817f74263bdc078d3872ba8fab6f1b09b
/1490511801.c
d7b7cc85955bc1df9dd6d8613a34fec74e38a66c
[]
no_license
Saisi/secret-octo-wookie
71aa331779216775ee10d8d0a738dd364a5c5202
a8e52e3fed94ab6993d4baaeaa926d659cac3735
refs/heads/master
2021-01-23T18:59:00.780545
2017-06-03T05:33:28
2017-06-03T05:33:28
25,811,730
0
0
null
null
null
null
UTF-8
C
false
false
445
c
/* * This is a RANDOMLY GENERATED PROGRAM. * * Generator: csmith 2.2.0 * Git version: dcef523 * Options: (none) * Seed: 618894286 */ #include "csmith.h" static long __undefined; /* --- Struct/Union Declarations --- */ struct S0 { const unsigned f0 : 21; signed f1 : 22; unsigned : 0; volatile unsigned f2 : 12; const signed f3 : 11; signed f4 : 22; const int32_t f5; unsigned f6 : 3; signed f7 : 8;
301c1f9bc9469f985eb6d1320a538c03dbc6282e
fdc312adbcf72c3432fad614ffca08cb69175ed8
/src/io/vimodempallpf2.c
104d9f66eae770c363099639ce2dc3e998f556f5
[]
no_license
n64decomp/libreultra
2231cc07e1edd8bfce1cea34036ebe15b2c9439a
1aca5c13ca041cef86f8dc194b727361dad9c09b
refs/heads/master
2022-02-12T01:57:21.614124
2020-02-01T21:07:06
2020-02-01T21:07:06
168,697,460
157
38
null
2022-01-29T11:31:37
2019-02-01T12:55:42
C
UTF-8
C
false
false
1,397
c
#include <os.h> #include <rcp.h> #include "viint.h" OSViMode osViModeMpalLpf2 = { OS_VI_MPAL_LPF2, // type { // comRegs VI_CTRL_TYPE_32 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_SERRATE_ON | VI_CTRL_ANTIALIAS_MODE_2 | 0x3000, // ctrl WIDTH(320), // width BURST(57, 30, 5, 70), // burst VSYNC(524), // vSync HSYNC(3088, 0), // hSync LEAP(3100, 3100), // leap HSTART(108, 748), // hStart SCALE(2, 0), // xScale VCURRENT(0), // vCurrent }, {// fldRegs { //[0] ORIGIN(1280), // origin SCALE(1, 0.25), // yScale HSTART(35, 509), // vStart BURST(2, 2, 11, 0), // vBurst VINTR(2), // vIntr }, { //[1] ORIGIN(1280), // origin SCALE(1, 0.75), // yScale HSTART(37, 511), // vStart BURST(4, 2, 14, 0), // vBurst VINTR(2), // vIntr }}};
[ "n64" ]
n64
2864487689bfaa13eb25b583480a5829bd30d354
7e2671a6af6cce900197ffd96cf3c56f1567e38e
/GENSCSI/CONST.H
31645ad6fbe772d86cbf462c9112950d8329e054
[]
no_license
OS2World/DEV-SAMPLES-DRV-SCSIPG
1d5deaa2d34847296af0531ceb253c163896af97
acdd9656fc0364b438fe5980ca88c1f78a4f6c7c
refs/heads/master
2020-04-22T08:04:08.089712
2019-10-06T14:42:38
2019-10-06T14:42:38
170,231,845
0
0
null
null
null
null
UTF-8
C
false
false
5,122
h
/*****************************************************************************/ /* This file contains all internal constants used by the device driver */ /* Constants exposed outside the DD are in INTERFAC.H */ /*****************************************************************************/ /* The largest command OS/2 can issue */ #define MAXCMD 27 /* Boolean values */ #define TRUE 1 #define FALSE 0 #define SUCCESS 0 /* Bit and return code values for the Request packet status field */ #define DONE 0x0100 #define ERROR 0x8000 #define DEV_ERR 0x4000 #define INV_CMD 0x0003 #define WRT_FAULT 0x000A #define GEN_FAIL 0x000C #define INIT_FAIL_STATUS 0x8100 /*****************************************************************************/ /* */ /* Constants used by devhlp */ /* */ /*****************************************************************************/ #define devhlp_SchedClockAddr 0x0000 #define devhlp_DevDone 0x0001 #define devhlp_Yield 0x0002 #define devhlp_TCYield 0x0003 #define devhlp_Block 0x0004 #define devhlp_Run 0x0005 #define devhlp_SemRequest 0x0006 #define devhlp_SemClear 0x0007 #define devhlp_SemHandle 0x0008 #define devhlp_PushReqPacket 0x0009 #define devhlp_PullReqPacket 0x000a #define devhlp_PullParticular 0x000b #define devhlp_SortReqPacket 0x000c #define devhlp_AllocReqPacket 0x000d #define devhlp_FreeReqPacket 0x000e #define devhlp_QueueInit 0x000f #define devhlp_QueueFlush 0x0010 #define devhlp_QueueWrite 0x0011 #define devhlp_QueueRead 0x0012 #define devhlp_Lock 0x0013 #define devhlp_Unlock 0x0014 #define devhlp_PhysToVirt 0x0015 #define devhlp_VirtToPhys 0x0016 #define devhlp_PhysToUVirt 0x0017 #define devhlp_AllocPhys 0x0018 #define devhlp_FreePhys 0x0019 #define devhlp_SetROMVector 0x001a #define devhlp_SetIRQ 0x001b #define devhlp_UnSetIRQ 0x001c #define devhlp_SetTimer 0x001d #define devhlp_ResetTimer 0x001e #define devhlp_MonitorCreate 0x001f #define devhlp_Register 0x0020 #define devhlp_DeRegister 0x0021 #define devhlp_MonWrite 0x0022 #define devhlp_MonFlush 0x0023 #define devhlp_GetDOSVar 0x0024 #define devhlp_SendEvent 0x0025 #define devhlp_ROMCritSection 0x0026 #define devhlp_VerifyAccess 0x0027 #define devhlp_AttachDD 0x002a #define devhlp_Internal 0x002a #define devhlp_InternalError 0x002b #define devhlp_AllocGDTSelector 0x002d #define devhlp_PhysToGDTSelector 0x002e #define devhlp_RealToProt 0x002f #define devhlp_ProtToReal 0x0030 #define devhlp_EOI 0x0031 #define devhlp_UnPhysToVirt 0x0032 #define devhlp_TickCount 0x0033 #define devhlp_GetLIDEntry 0x0034 #define devhlp_FreeLIDEntry 0x0035 #define devhlp_ABIOSCall 0x0036 #define devhlp_ABIOSCommonEntry 0x0037 #define devhlp_GetDeviceBlock 0x0038 #define devhlp_RegisterStackUseage 0x003A #define devhlp_VideoPause 0x003C #define devhlp_DispMsg 0x003D #define devhlp_RegisterPDD 0x0050 #define devhlp_RegisterBeep 0x0051 #define devhlp_Beep 0x0052 #define devhlp_FreeGDTSelector 0x0053 #define devhlp_PhysToGDTSel 0x0054 #define devhlp_VMLock 0x0055 #define devhlp_VMUnLock 0x0056 #define devhlp_VMAlloc 0x0057 #define devhlp_VMFree 0x0058 #define devhlp_VMProcessToGlobal 0x0059 #define devhlp_VMGlobalToProcess 0x005A #define devhlp_VirtToLin 0x005B #define devhlp_LinToGDTSelector 0x005C #define devhlp_GetDescInfo 0x005D #define devhlp_LinToPageList 0x005E #define devhlp_PageListToLin 0x005F #define devhlp_PageListToGDT 0x0060 #define devhlp_RegisterTmrDD 0x0061 #define devhlp_AllocateCtxHook 0x0063 #define devhlp_FreeCtxHook 0x0064 #define devhlp_ArmCtxHook 0x0065 #define devhlp_VMSetMem 0x0066 #define devhlp_OpenEventSem 0x0067 #define devhlp_CloseEventSem 0x0068 #define devhlp_PostEventSem 0x0069 #define devhlp_ResetEventSem 0x006A #define devhlp_DynamicAPI 0x006c 
6080f1f5d3f6d4f6d1820f1618938c67e0b73415
a82dbc458ac49f57407613a4c8c7955a25f856a1
/Project/DFUDemo/dfu_mal.h
20c586a5e6b0e911aa80aaf7d5bfdcfd95dabaff
[]
no_license
lilpako/ministm32-bsp
4c3b4eb2aa6e4474504882a79f9b75826b6b4161
eef68c272c14298ad86d1d87e3ff1c206ab23844
refs/heads/master
2021-01-10T08:10:09.815665
2011-11-25T05:44:19
2011-11-25T05:44:19
55,165,465
0
0
null
null
null
null
UTF-8
C
false
false
2,755
h
/******************** (C) COPYRIGHT 2011 STMicroelectronics ******************** * File Name : dfu_mal.h * Author : MCD Application Team * Version : V3.3.0 * Date : 21-March-2011 * Description : Header for dfu_mal.c file. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ #ifndef __DFU_MAL_H #define __DFU_MAL_H #include "stm32f10x.h" #include "dfu_mal.h" #include "usb_desc.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #define MAL_OK 0 #define MAL_FAIL 1 #define MAX_USED_MEDIA 3 #define MAL_MASK 0xFC000000 #define INTERNAL_FLASH_BASE 0x08000000 #define SPI_FLASH_BASE 0x00000000 #define NOR_FLASH_BASE 0x64000000 #define NOR_M29W128F 0x2212 #define NOR_M29W128G 0x2221 #define NOR_S29GL128 0x2221 /* utils macro ---------------------------------------------------------------*/ #define _1st_BYTE(x) (uint8_t)((x)&0xFF) /* 1st addressing cycle */ #define _2nd_BYTE(x) (uint8_t)(((x)&0xFF00)>>8) /* 2nd addressing cycle */ #define _3rd_BYTE(x) (uint8_t)(((x)&0xFF0000)>>16) /* 3rd addressing cycle */ #define _4th_BYTE(x) (uint8_t)(((x)&0xFF000000)>>24) /* 4th addressing cycle */ /* Exported macro ------------------------------------------------------------*/ #define SET_POLLING_TIMING(x) buffer[1] = _1st_BYTE(x);\ buffer[2] = _2nd_BYTE(x);\ buffer[3] = _3rd_BYTE(x); /* Exported functions ------------------------------------------------------- */ uint16_t MAL_Init (void); uint16_t MAL_Erase (uint32_t SectorAddress); uint16_t MAL_Write (uint32_t SectorAddress, uint32_t DataLength); uint8_t *MAL_Read (uint32_t SectorAddress, uint32_t DataLength); uint16_t MAL_GetStatus(uint32_t SectorAddress ,uint8_t Cmd, uint8_t *buffer); extern uint8_t MAL_Buffer[wTransferSize]; /* RAM Buffer for Downloaded Data */ #endif /* __DFU_MAL_H */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
d38bdbe028621c2fdd33e3d1563822cd66aef12d
7207d68615abb44d978a7cd0f4318cd9594b321d
/libft/ft_memdel.c
e87df2e38232419356da83ab2408ff650d9abdf9
[]
no_license
AlinaVas/Fractol
68b4fd8eda574ba3d2dcc00ba6da4c2490e6fcc8
f243c16e66d1f52561143d4d45b72a4ffdc6679b
refs/heads/master
2020-03-25T23:13:06.215791
2018-08-26T15:30:15
2018-08-26T15:30:15
144,265,164
0
0
null
null
null
null
UTF-8
C
false
false
995
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memdel.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: afesyk <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/04 16:45:39 by afesyk #+# #+# */ /* Updated: 2017/11/04 16:45:41 by afesyk ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_memdel(void **ap) { if (ap == NULL) return ; free(*ap); *ap = NULL; }
ff7ad2e1c0ac53a8e1f1a7d473ace635600d2462
ae1bb9e087acc38f67e23320b79ed6724be2cae7
/VS2017_SDL/lvgl_VS2017/User/App/common/Src/LED.c
cdaa8751f4b76eee4e6fcdc3d170ac233eadc673
[]
no_license
CVZehn/LVGL_VS
b2b5fb2e126c2294fb7d49c39e9ff5ed002e1b76
780f9c025ba8495ae1515e7deca3e638f60e4f88
refs/heads/master
2020-04-12T19:11:53.697111
2018-12-15T15:52:02
2018-12-15T15:52:53
162,702,316
0
1
null
null
null
null
GB18030
C
false
false
2,805
c
/** ****************************************************************************** * @file led.c * @author ZSY * @version V1.0.0 * @date 2018-07-08 * @brief 实现LED闪烁 * @History * Date Author version Notes * 2018-06-22 ZSY V1.0.0 first version. * 2018-09-07 ZSY V1.0.1 继续完善LED方法,提高可以移植性. */ /* Includes ------------------------------------------------------------------*/ #include "led.h" /* 若使用LL库,请定义USER_EFFI为1 */ #ifndef USER_EFFI #define USER_EFFI 0 #endif /* 定义使用的LED */ #define USER_LED0 //#define USER_LED1 #ifdef USER_LED0 #define _LED0_GPIO_PORT LED_GPIO_Port #define _LED0_PIN LED_Pin #endif #ifdef USER_LED1 #define _LED1_GPIO_PORT LED1_GPIO_Port #define _LED1_PIN LED1_Pin #endif #ifdef USER_LED0 /** * @func LED0_On * @brief LED0打开 * @note LED0为低电平打开,若使用高电平打开,请修改GPIO_PIN_RESET为GPIO_PIN_SET * @retval 无 */ void LED0_On(void) { #if USER_EFFI == 1 LL_GPIO_ResetOutputPin(_LED0_GPIO_PORT, _LED0_PIN); #else HAL_GPIO_WritePin(_LED0_GPIO_PORT, _LED0_PIN, GPIO_PIN_RESET); #endif } /** * @func LED0_Off * @brief LED0关闭 * @note LED0为高电平关闭,若使用低电平关闭,请修改GPIO_PIN_SET为GPIO_PIN_RESET * @retval 无 */ void LED0_Off(void) { #if USER_EFFI == 1 LL_GPIO_SetOutputPin(_LED0_GPIO_PORT, _LED0_PIN); #else HAL_GPIO_WritePin(_LED0_GPIO_PORT, _LED0_PIN, GPIO_PIN_SET); #endif } #endif #ifdef USER_LED1 /** * @func LED1_On * @brief LED1打开 * @note LED1为低电平打开,若使用高电平打开,请修改GPIO_PIN_RESET为GPIO_PIN_SET * @retval 无 */ void LED1_On(void) { #if USER_EFFI == 1 LL_GPIO_ResetOutputPin(_LED1_GPIO_PORT, _LED1_PIN); #else HAL_GPIO_WritePin(_LED1_GPIO_PORT, _LED1_PIN, GPIO_PIN_RESET); #endif } /** * @func LED1_Off * @brief LED1关闭 * @note LED1为高电平关闭,若使用低电平关闭,请修改GPIO_PIN_SET为GPIO_PIN_RESET * @retval 无 */ void LED1_Off(void) { #if USER_EFFI == 1 LL_GPIO_SetOutputPin(_LED1_GPIO_PORT, _LED1_PIN); #else HAL_GPIO_WritePin(_LED1_GPIO_PORT, _LED1_PIN, GPIO_PIN_SET); #endif } #endif /** * @func LED_TickInc * @brief 控制LED闪烁,由中断函数调用 * @note * @retval 无 */ void LED_TickInc(void) { static uint16_t LED_Tick = 0; static uint8_t Flag = true; LED_Tick++; if (LED_Tick >= 50) { LED_Tick = 0; if (Flag == true) { Flag = false; LED0_Off(); } else { Flag = true; LED0_On(); } } }
b6103d49e307cf6f3993808fb4df3c0caa680d2b
58a49898cf0ba14336e3b727c833e13379938895
/asm/src/checks.c
70a402cf66883cd0c0c82c74a87f7b70237af7a2
[]
no_license
jwalle/Corewar
f739a815d267c4b9591abca21a6daae917ee08d3
dd61b2ade9ad20e06fc894475d8800f30b08f0e7
refs/heads/master
2021-01-20T20:41:51.606436
2016-08-28T17:10:42
2016-08-28T17:10:42
62,799,654
0
1
null
null
null
null
UTF-8
C
false
false
3,108
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* checks.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rhoffsch <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/05 06:50:15 by rhoffsch #+# #+# */ /* Updated: 2016/08/05 06:50:17 by rhoffsch ### ########.fr */ /* */ /* ************************************************************************** */ #include <asm.h> static char *ft_grep(char *str, int len) { char *dst; int i; int q; i = len; q = 0; while (str[i] == 32 || str[i] == '\t') i++; if (str[i] != '\"') ft_exit("Error in infos strings", INFOERR); dst = ft_strdup(str + i + 1); dst[ft_strlen(dst) - 1] = '\0'; while (str[i] != '\0') { if (str[i] == '\"') q++; if (q == 2 && str[i + 1] != '\0') ft_exit("Error in infos strings", INFOERR); i++; } if (q != 2 || str[i - 1] != '\"') ft_exit("Error in infos strings", INFOERR); free(str); return (dst); } static void clean_infos(t_env *e) { char *ptr; while (e->info[0][0] == COMMENT_CHAR || e->info[0][0] == ';' \ || ft_linelen(e->info[0]) == 0) { ptr = e->info[0]; e->info[0] = ft_strdup(e->info[0] + ft_linelen(e->info[0]) + 1); free(ptr); } while (e->info[1][0] == COMMENT_CHAR || e->info[1][0] == ';' \ || ft_linelen(e->info[1]) == 0) { ptr = e->info[1]; e->info[1] = ft_strdup(e->info[1] + ft_linelen(e->info[1]) + 1); free(ptr); } } void check_label_chars(char *label) { int i; i = 0; while (label[i] != '\0') { if (ft_strchr(LABEL_CHARS, label[i]) == NULL) ft_exit("Error: invalid character(s) in label.", INV_LABEL); i++; } } void check_all_label_chars(t_ins *ins) { t_ins *ptr; t_label *ptr2; ptr = ins; while (ptr != NULL) { ptr2 = ptr->labels; while (ptr2 != NULL) { check_label_chars(ptr2->name); ptr2 = ptr2->next; } ptr = ptr->next; } } void checks(t_env *e) { char *ptr; int name; int com; clean_infos(e); name = ft_strlen(NAME_CMD_STRING); com = ft_strlen(COMMENT_CMD_STRING); if (ft_strncmp(e->info[0], NAME_CMD_STRING, name) == 0 \ && ft_strncmp(e->info[1], COMMENT_CMD_STRING, com) == 0) ; else if (ft_strncmp(e->info[1], NAME_CMD_STRING, name) == 0 \ && ft_strncmp(e->info[0], COMMENT_CMD_STRING, com) == 0) { ptr = e->info[0]; e->info[0] = e->info[1]; e->info[1] = ptr; } else ft_exit("Error in infos", INFOERR); if (ft_strlen(e->info[0] = ft_grep(e->info[0], name)) > PROG_NAME_LENGTH \ || ft_strlen(e->info[1] = ft_grep(e->info[1], com)) > COMMENT_LENGTH) ft_exit("Error in infos string: too long", INFOERR); check_all_label_chars(e->ins); }
0ab517276d934260106f183852a8f985bea2c44a
0373517d4673eb50ec74388320642663734090ca
/rCommands/src/CMDtblConvCoord.C
942dd16756c3c4f32f4a7d3643304d7d9bab15d0
[]
no_license
nimaehsani/RGIS
6ba66d987282bb9d53c2b0e54658456e19b06c89
fd55b17d5c4d4638ddfd6c202a06655d75bce18a
refs/heads/master
2020-04-03T06:09:42.050657
2012-01-13T05:36:17
2012-01-13T05:36:17
null
0
0
null
null
null
null
UTF-8
C
false
false
4,906
c
/****************************************************************************** GHAAS RiverGIS Utilities V1.0 Global Hydrologic Archive and Analysis System Copyright 1994-2011, UNH - CCNY/CUNY CMDtblConvCoord.C [email protected] *******************************************************************************/ #include <cm.h> #include <DB.H> #include <DBif.H> #include <RG.H> int main (int argc,char *argv []) { int argPos, argNum = argc, ret, verbose = false; DBInt recID, i, deg, min, sec, strLen; DBFloat coord; char crdStr [DBStringLength]; char *minStr, *secStr; char *tableName = (char *) NULL; char *srcFieldName = (char *) NULL; char *dstFieldName = (char *) NULL; DBObjData *data; DBObjTable *table; DBObjTableField *srcField; DBObjTableField *dstField; DBObjRecord *record; for (argPos = 1;argPos < argNum; ) { if (CMargTest (argv [argPos],"-a","--table")) { if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) { CMmsgPrint (CMmsgUsrError,"Missing table name!"); return (CMfailed); } tableName = argv [argPos]; if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break; continue; } if (CMargTest (argv [argPos],"-f","--field")) { if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) { CMmsgPrint (CMmsgUsrError,"Missing field name!"); return (CMfailed); } srcFieldName = argv [argPos]; if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break; continue; } if (CMargTest (argv [argPos],"-r","--rename")) { if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) { CMmsgPrint (CMmsgUsrError,"Missing second field name!"); return (CMfailed); } dstFieldName = argv [argPos]; if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break; continue; } if (CMargTest (argv [argPos],"-V","--verbose")) { verbose = true; if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break; continue; } if (CMargTest (argv [argPos],"-h","--help")) { CMmsgPrint (CMmsgInfo,"%s [options] <input file> <output file>",CMprgName(argv[0])); CMmsgPrint (CMmsgInfo," -a,--table [table name]"); CMmsgPrint (CMmsgInfo," -f,--field [coord field name]"); CMmsgPrint (CMmsgInfo," -r,--rename [output field]"); CMmsgPrint (CMmsgInfo," -V,--verbose"); CMmsgPrint (CMmsgInfo," -h,--help"); return (DBSuccess); } if ((argv [argPos][0] == '-') && ((int) strlen (argv [argPos]) > 1)) { CMmsgPrint (CMmsgUsrError,"Unknown option: %s!",argv [argPos]); return (CMfailed); } argPos++; } if (argNum > 3) { CMmsgPrint (CMmsgUsrError,"Extra arguments!"); return (CMfailed); } if (verbose) RGlibPauseOpen (argv[0]); if (srcFieldName == (char *) NULL) { CMmsgPrint (CMmsgUsrError,"Coordinate field is not set!"); return (CMfailed); } data = new DBObjData (); if (((argNum > 1) && (strcmp (argv [1],"-") != 0) ? data->Read (argv [1]) : data->Read (stdin)) == DBFault) { delete data; return (CMfailed); } if (tableName == (char *) NULL) tableName = DBrNItems; if ((table = data->Table (tableName)) == (DBObjTable *) NULL) { CMmsgPrint (CMmsgUsrError,"Invalid table!"); delete data; return (CMfailed); } if ((srcField = table->Field (srcFieldName)) == (DBObjTableField *) NULL) { CMmsgPrint (CMmsgUsrError,"Invalid coordinate field [%s]!",srcFieldName); delete data; return (CMfailed); } if (dstFieldName == (char *) NULL) dstFieldName = (char *) "DecimalCoord"; { if ((dstField = table->Field (dstFieldName)) == (DBObjTableField *) NULL) { dstField = new DBObjTableField (dstFieldName,DBVariableFloat,"%10.3f",sizeof (DBFloat4),false); table->AddField (dstField); } else { if (dstField->Type () != DBVariableFloat) { CMmsgPrint (CMmsgUsrError,"Invalid coordinate field type!"); delete data; return (CMfailed); } } } for (recID = 0;recID < table->ItemNum ();++recID) { record = table->Item (recID); strncpy (crdStr,srcField->String (record),sizeof (crdStr) - 1); if ((strLen = strlen (crdStr)) > 0) { minStr = secStr = (char *) NULL; for (i = 0;i < strLen;++i) if (crdStr [i] == ':') minStr = crdStr + i + 1; else if (crdStr [i] == '\'') secStr = crdStr + i + 1; else if (crdStr [i] == '\"') crdStr [i] = '\0'; if (sscanf (crdStr,"%d",&deg) != 1) continue; coord = (float) deg; if ((minStr != (char *) NULL) && (sscanf (minStr,"%d",&min) == 1)) { coord = coord + (deg > 0 ? 1.0 : -1.0) * (DBFloat) min / 60.0; if ((secStr != (char *) NULL) && (sscanf (secStr,"%d",&sec) == 1)) coord = coord + (deg > 0 ? 1.0 : -1.0) * (DBFloat) sec / 3600.0; } dstField->Float (record,coord); } } ret = (argNum > 2) && (strcmp (argv [2],"-") != 0) ? data->Write (argv [2]) : data->Write (stdout); delete data; if (verbose) RGlibPauseClose (); return (ret); }
bb5d5a78cd72b759b182c6ab5442bfd48c9f5a13
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
/lib/libc/include/any-linux-any/linux/netfilter/xt_iprange.h
8dfc04d607f0c3df101bd6fe72d1bb13ea266dc3
[ "MIT" ]
permissive
ziglang/zig
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
refs/heads/master
2023-08-31T13:16:45.980913
2023-08-31T05:50:29
2023-08-31T05:50:29
40,276,274
25,560
2,399
MIT
2023-09-14T21:09:50
2015-08-06T00:51:28
Zig
UTF-8
C
false
false
580
h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_NETFILTER_XT_IPRANGE_H #define _LINUX_NETFILTER_XT_IPRANGE_H 1 #include <linux/types.h> #include <linux/netfilter.h> enum { IPRANGE_SRC = 1 << 0, /* match source IP address */ IPRANGE_DST = 1 << 1, /* match destination IP address */ IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ IPRANGE_DST_INV = 1 << 5, /* -"- */ }; struct xt_iprange_mtinfo { union nf_inet_addr src_min, src_max; union nf_inet_addr dst_min, dst_max; __u8 flags; }; #endif /* _LINUX_NETFILTER_XT_IPRANGE_H */
6e87bd93252258cc67a229c9a4c1f2d71eaaf904
38e425829da130bef153329744e70c416c6bdfc0
/lib/pmalloc.c
45ebc820622d2c1074635963b58d1550059d01e5
[]
no_license
kermit987/lemin
2d7ea397083c41d298c36d1c6fa37ac8c1f231c5
470d043ad88f8f8fe6fcd005968667358d8f5bcf
refs/heads/master
2022-02-10T00:12:37.203257
2019-09-05T07:16:17
2019-09-05T07:16:17
null
0
0
null
null
null
null
UTF-8
C
false
false
431
c
/* ** pmalloc.c for in /home/karmes_l/Projets/Systeme_Unix/minishell1/v2/lib ** ** Made by lionel karmes ** Login <[email protected]> ** ** Started on Fri Jan 16 12:11:29 2015 lionel karmes ** Last update Thu Apr 30 15:52:09 2015 lionel karmes */ #include "my.h" void *pmalloc(int size) { void *bytes; if ((bytes = malloc(size)) == NULL) my_putstrerror("[ERROR] : malloc couldn't alloc\n"); return (bytes); }
0d03625b9a9d20e50eaad777812ffe633e750aa0
54fad01b6a7bcd03ae081f9127b34399fb2d21bd
/Microchip/TCPIP-BSD/earp.c
7429179e574eae6a96357345a1f852a73dca8614
[]
no_license
douglaskatz/PIC32-Mass-Storage
442a227469945f83d55bd9fc65fede2046b9d1b4
fdcf4dfefae66f0b9ce41e792419c90bb4f1d833
refs/heads/master
2020-12-07T10:45:41.028028
2016-12-14T19:18:25
2016-12-14T19:18:25
73,502,321
2
0
null
null
null
null
WINDOWS-1252
C
false
false
6,232
c
/********************************************************************* * * ARP module for TCP/IP Stack * ********************************************************************* * FileName: eARP.c * Company: Microchip Technology, Inc. * * Software License Agreement: * * The software supplied herewith by Microchip Technology Incorporated * (the “Company”) for its dsPIC30F and PICmicro® Microcontroller is intended * and supplied to you, the Company’s customer, for use solely and * exclusively on Microchip's dsPIC30F and PICmicro Microcontroller products. * The software is owned by the Company and/or its supplier, and is * protected under applicable copyright laws. All rights are reserved. * Any use in violation of the foregoing restrictions may subject the * user to criminal sanctions under applicable laws, as well as to * civil liability for the breach of the terms and conditions of this * license. * * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. * * $Id: eARP.c,v 1.2 2006/10/24 16:39:07 C12923 Exp $ * ********************************************************************/ #include "_tcpip_common.h" /* * ETHERNET packet type as defined by IEEE 802.3 */ #define HW_ETHERNET (0x0001) typedef struct _ARP_PKT { WORD HardwareType; WORD Protocol; BYTE MACAddrLen; BYTE ProtocolLen; WORD Operation; BYTE SenderMACAddr[ETH_ADRLEN]; BYTE SenderIPAddr[4]; BYTE TargetMACAddr[ETH_ADRLEN]; BYTE TargetIPAddr[4]; } ARP_PKT; extern BYTE broadcastMAC[]; /* function prototypes */ void SwapARPPacket(ARP_PKT *p); void APP_DuplicateIPError(); /********************************************************************* * Function: void ARP_SendPkt( WORD OpCode, DWORD SenderIP, BYTE* pSenderMAC, * DWORD TargetIP, BYTE* pTargetMAC ) * * PreCondition: None * Input: OpCode - Request or Responce Op-Code. see arp.h * SenderIP - local IP Address * pSenderMAC - Pointer to local MAC address string. * TargetIP - Remote node IP Address * pTargetMAC - Pointer to remote MAC address string. * Output: None * Side Effects: None * Overview: This function formats and transmits an ARP packet. * Note: ********************************************************************/ void ARP_SendPkt( WORD OpCode, DWORD SenderIP, BYTE* pSenderMAC, DWORD TargetIP, BYTE* pTargetMAC ) { ARP_PKT* pArp; NET_PKT* sbfr = AllocPacketBuffer( sizeof(ARP_PKT) + sizeof(ETHER_HEADER), 0, PKT_FLAG_TX|PKT_TX_AUTO_DEALLOC ); if( sbfr == NULL ) //make sure we have good buffer { return; } FormatEtherTxFrame( sbfr, ETH_PROTO_ARP, pSenderMAC ); SetEtherTxDestMAC( sbfr, pTargetMAC ); // Fillin the ARP data pArp = (ARP_PKT*)sbfr->pNetworkLayer; //pointer setup by MAC_format... pArp->HardwareType = swaps(HW_ETHERNET); //w pArp->Protocol = swaps(ETH_PROTO_IP); //w pArp->MACAddrLen = ETH_ADRLEN; pArp->ProtocolLen = sizeof(DWORD); pArp->Operation = swaps(OpCode); //w memcpy( pArp->SenderMACAddr, pSenderMAC, ETH_ADRLEN ); _dwordToArray(SenderIP, pArp->SenderIPAddr); memcpy( pArp->TargetMACAddr, pTargetMAC, ETH_ADRLEN ); _dwordToArray(TargetIP, pArp->TargetIPAddr); sbfr->PktLen += sizeof(ARP_PKT); MACTransmit( sbfr ); } /********************************************************************* * Function: void InitiateARP( DWORD TargetIP ) * * PreCondition: AppConfig must be properly initialized * Input: TargetIP - Remote node IP Address * Output: None * Side Effects: None * Overview: This function broadcasts an ARP request packet. * Note: ********************************************************************/ void InitiateARP( DWORD TargetIP ) { //if the target is on the same network, then use targetIP, else use gateway ip TargetIP = ((SysIPAddr.Val ^ TargetIP) & SysIPMask.Val) ? SysIPGateway.Val : TargetIP; ARP_SendPkt( ARP_OPERATION_REQ, SysIPAddr.Val, SysMACAddr.v, TargetIP, broadcastMAC ); } /********************************************************************* * Function: void ARP_RxHandler( NET_PKT *sbfr ) * * PreCondition: None * Input: sbfr - Pointer to New ARP Packet received * Output: None * Side Effects: None * Overview: This function process ARP packets received by the local NIC * Note: ********************************************************************/ void ARP_RxHandler( NET_PKT *sbfr ) { ARP_PKT * pARP; DWORD ip_addr, SenderIP; pARP = (ARP_PKT *)sbfr->pNetworkLayer; SwapARPPacket( pARP ); if( pARP->HardwareType != HW_ETHERNET || pARP->MACAddrLen != ETH_ADRLEN || pARP->ProtocolLen != sizeof(DWORD) || pARP->Protocol != ETH_PROTO_IP || sbfr->PktType == PKT_NON_LOCAL || sbfr->PktType == PKT_LOOPBACK ) { goto ARP_DropPkt; } ip_addr = _arrayToDword(pARP->TargetIPAddr); if( ip_addr == SysIPAddr.Val ) // dest to our IP address { //if( pARP->Operation == ARP_OPERATION_REQ ) // Generate the ARP reply. SenderIP = _arrayToDword(pARP->SenderIPAddr); if( ip_addr == SenderIP ) { } else AddHostRoute( SenderIP, pARP->SenderMACAddr, TRUE ); if( pARP->Operation == ARP_OPERATION_REQ ) ARP_SendPkt( ARP_OPERATION_RESP, SysIPAddr.Val, SysMACAddr.v, SenderIP, pARP->SenderMACAddr ); } DeAllocateBuffer(sbfr); return; ///////////////////////////// ARP_DropPkt: DeAllocateBuffer(sbfr); } /////////////////////////////////////////////////// /////////////////////////////////////////////////// void SwapARPPacket(ARP_PKT *p) { p->HardwareType = swaps(p->HardwareType); p->Protocol = swaps(p->Protocol); p->Operation = swaps(p->Operation); }
d43d0a3024147adbfa2b5b3cfb2c545f3b85f978
2a298ee69e3cd69ddf812e20d26914ac1dc4840c
/pkg/thsice/thsice_test_addfluid.h
c71b401d1e89f3e4237be25e74e7ef3c9e2e3a35
[]
no_license
ElizabethYankovsky/MITgcm_c65t
01e5315a813faa75b2c1ed60612c774d56ec8cbc
f39721646f9feb97eaef97761a94f2aa2f593191
refs/heads/master
2021-07-16T21:46:14.778995
2020-08-03T22:14:29
2020-08-03T22:14:29
197,478,927
0
0
null
null
null
null
UTF-8
C
false
false
979
h
C $Header: /u/gcmpack/MITgcm/pkg/thsice/thsice_test_addfluid.h,v 1.1 2008/08/24 21:50:12 jmc Exp $ C $Name: checkpoint65t $ #ifdef ALLOW_ADDFLUID C this is a small piece of code to add to S/R thsice_main.F C to check AddFluid implementation : C uses addMass instead of EmPmR but solution should not change. C (tested in global_ocean.cs32x15.thsice set-up) IF ( selectAddFluid.NE.0 .AND. hsMax.GT.hiMax ) THEN IF ( myIter.EQ.nIter0 ) THEN WRITE(0,*) 'THSICE_MAIN: mv EmPmR to addMass(k=1)' ENDIF DO bj=myByLo(myThid),myByHi(myThid) DO bi=myBxLo(myThid),myBxHi(myThid) DO j = 1-OLy, sNy+OLy-1 DO i = 1-OLx, sNx+OLx-1 addMass(i,j,1,bi,bj) = -EmPmR(i,j,bi,bj) & *rA(i,j,bi,bj) & *maskC(i,j,1,bi,bj) EmPmR(i,j,bi,bj) = 0. _d 0 ENDDO ENDDO ENDDO ENDDO ENDIF #endif /* ALLOW_ADDFLUID */
faf9db0f7031c0907642af7622cb4137aeafd3b0
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/lab/engine/code/ui/extr_ui_shared.c_MenuParse_fadeClamp.c
8aa6a0a7213cc6835e6d91dabc080af8758754da
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
905
c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ qboolean ; struct TYPE_2__ {int /*<<< orphan*/ fadeClamp; } ; typedef TYPE_1__ menuDef_t ; typedef int /*<<< orphan*/ itemDef_t ; /* Variables and functions */ int /*<<< orphan*/ PC_Float_Parse (int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ qfalse ; int /*<<< orphan*/ qtrue ; qboolean MenuParse_fadeClamp( itemDef_t *item, int handle ) { menuDef_t *menu = (menuDef_t*)item; if (!PC_Float_Parse(handle, &menu->fadeClamp)) { return qfalse; } return qtrue; }
a73ff5bae7b7faefcf21a4ba8508042371e10497
c2cedcf36667730f558ab354bea4505b616c90d2
/players/cloud/Nintendo/Zelda/mobs/aquadong.c
1e7492b910bb10b2744661b1e66eb0f9e44b0129
[]
no_license
wugouzi/Nirvlp312mudlib
965ed876c7080ab00e28c5d8cd5ea9fc9e46258f
616cad7472279cc97c9693f893940f5336916ff8
refs/heads/master
2023-03-16T03:45:05.510851
2017-09-21T17:05:00
2017-09-21T17:05:00
null
0
0
null
null
null
null
UTF-8
C
false
false
1,703
c
/* * Aquadonger * /Nintendo/Zelda/mobs/aquadong.c * Cloud 2015 * Three mobs put into one. Aquamentus/Dodongo/Digdogger * Splits into 4 smaller Aquadongers after being hit * Place Holder */ #include "/obj/ansi.h"; inherit "/obj/monster"; #define DEST "/players/cloud/Nintendo/Zelda/rooms/dun8.c" reset(arg) { ::reset(arg); if (!arg) { set_name(""+HIR+"Aquadonger"+NORM+""); set_alt_name("aqua"); set_alias("aquadonger"); set_short(""+HIR+"Aquadonger"+NORM+""); set_race( "Mix"); set_gender("male"); set_long("\n"+ ".\n"); set_level(1); set_ac(1); set_wc(1); set_hp(5000); set_al(-500); set_aggressive(0); set_no_exp_value(); } } void init() { ::init(); add_action("nogou","up"); } nogou() { write("You must first defeat "+HIR+"Aquadonger"+NORM+" before advancing to the next level! \n"); return 1; } heart_beat() { int B; B = (1 + random(100)); ::heart_beat(); if(!environment()) return; if(attacker_ob && present(attacker_ob, environment(this_object()))) { if(B > 0) break_apart(); } } break_apart() { tell_room(environment(), "\n\t"+HIY+""+query_name()+""+NORM+" breaks apart into several smaller clones of itself!\n\n"); move_object(clone_object("/players/cloud/Nintendo/Zelda/mobs/miniaqua.c"), DEST); move_object(clone_object("/players/cloud/Nintendo/Zelda/mobs/miniaqua.c"), DEST); move_object(clone_object("/players/cloud/Nintendo/Zelda/mobs/miniaqua.c"), DEST); move_object(clone_object("/players/cloud/Nintendo/Zelda/mobs/miniaqua.c"), DEST); destruct(present("aquadonger")); }
2c95bfc68f578437c470e624398fba5677c45ddc
3c2441f940a8bc40990fb590f7dcc36f3305d49f
/src/core_ev.c
1c211ca025a02d4c8ebbb5403e704720cd4528a1
[ "BSD-3-Clause" ]
permissive
89343671/cfadmin
01f83aec56e2c8cf17b68d5298e986003700a397
1f5ed698bedf96036113bcc6394baed90a435ea2
refs/heads/master
2023-05-03T13:41:39.030796
2021-05-18T16:08:49
2021-05-18T16:08:49
null
0
0
null
null
null
null
UTF-8
C
false
false
2,695
c
#include "core_ev.h" /* =========== Timer =========== */ void core_timer_init(core_timer *timer, _TIMER_CB cb){ timer->repeat = timer->at = 0x0; ev_init(timer, cb); } void core_timer_start(core_loop *loop, core_timer *timer, ev_tstamp timeout){ timer->repeat = timeout; ev_timer_again(loop ? loop : CORE_LOOP, timer); } void core_timer_stop(core_loop *loop, core_timer *timer){ timer->repeat = timer->at = 0x0; ev_timer_again(loop ? loop : CORE_LOOP, timer); } /* =========== Timer =========== */ /* =========== IO =========== */ void core_io_init(core_io *io, _IO_CB cb, int fd, int events){ ev_io_init(io, cb, fd, events); } void core_io_start(core_loop *loop, core_io *io){ ev_io_start(loop ? loop : CORE_LOOP, io); } void core_io_stop(core_loop *loop, core_io *io){ if (io->events || io->fd){ ev_io_stop(loop ? loop : CORE_LOOP, io); io->fd = io->events = -1; } } /* =========== IO =========== */ /* =========== TASK =========== */ void core_task_init(core_task *task, _TASK_CB cb){ ev_idle_init(task, cb); } void core_task_start(core_loop *loop, core_task *task){ ev_idle_start(loop ? loop : CORE_LOOP, task); } void core_task_stop(core_loop *loop, core_task *task){ ev_idle_stop(loop ? loop : CORE_LOOP, task); } /* =========== TASK =========== */ /* =========== Signal =========== */ void core_signal_init(core_signal *signal, _SIGNAL_CB cb, int signum){ ev_signal_init(signal, cb, signum); } void core_signal_start(core_loop *loop, core_signal *signal){ ev_signal_start(loop ? loop : CORE_LOOP, signal); } /* =========== Signal =========== */ core_loop* core_loop_fork(core_loop *loop) { // ev_loop_fork(loop); return loop; } core_loop* core_default_loop(){ int BEST_BACKEND = 0; #if defined(__MSYS__) || defined(__CYGWIN__) BEST_BACKEND |= EVBACKEND_POLL | EVFLAG_SIGNALFD | EVFLAG_NOINOTIFY; #elif defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) BEST_BACKEND |= EVBACKEND_KQUEUE | EVFLAG_NOINOTIFY | EVFLAG_NOTIMERFD; #elif defined(linux) || defined(__linux) || defined(__linux__) BEST_BACKEND |= EVBACKEND_EPOLL | EVFLAG_SIGNALFD; #else BEST_BACKEND |= EVBACKEND_SELECT | EVFLAG_NOINOTIFY | EVFLAG_NOTIMERFD; #endif return ev_default_loop( BEST_BACKEND | EVFLAG_FORKCHECK ); } void core_break(core_loop *loop, int mode){ return ev_break(loop ? loop : CORE_LOOP, mode); } void core_ev_set_allocator(void *(*cb)(void *ptr, long size)){ return ev_set_allocator(cb); } void core_ev_set_syserr_cb(void (*cb)(const char *msg)){ return ev_set_syserr_cb(cb); } int core_start(core_loop *loop, int mode){ return ev_run(loop ? loop : CORE_LOOP, mode); }
111bee3d6f652dbe0e46c7a275ec6f4866ed974c
d85b1f3ce9a3c24ba158ca4a51ea902d152ef7b9
/testcases/CWE78_OS_Command_Injection/s07/CWE78_OS_Command_Injection__wchar_t_file_execl_52c.c
c1218e7be03a36b082dbf2708b4c767f9b54a947
[]
no_license
arichardson/juliet-test-suite-c
cb71a729716c6aa8f4b987752272b66b1916fdaa
e2e8cf80cd7d52f824e9a938bbb3aa658d23d6c9
refs/heads/master
2022-12-10T12:05:51.179384
2022-11-17T15:41:30
2022-12-01T15:25:16
179,281,349
34
34
null
2022-12-01T15:25:18
2019-04-03T12:03:21
null
UTF-8
C
false
false
2,139
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_file_execl_52c.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-52c.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: file Read input from a file * GoodSource: Fixed string * Sink: execl * BadSink : execute command with wexecl * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #define COMMAND_ARG1 L"-c" #define COMMAND_ARG2 L"ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #ifdef _WIN32 #include <process.h> #define EXECL _wexecl #else /* NOT _WIN32 */ #define EXECL execl #endif /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE78_OS_Command_Injection__wchar_t_file_execl_52c_badSink(wchar_t * data) { /* wexecl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__wchar_t_file_execl_52c_goodG2BSink(wchar_t * data) { /* wexecl - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECL(COMMAND_INT_PATH, COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL); } #endif /* OMITGOOD */
30c3e59042f6b8890bc77b9a92ad691de9cbeb69
45796fd41be178d12e1f16aa260f08557113b8a4
/usb/usbrtc.h
3b2e64ddc1902227c2bb5a706bf3b35d4820fb7c
[]
no_license
mist-devel/mist-firmware
19807010ca218258959b01e3c538e2cea965d046
52f9085fde10336ff693c244962342fed08458e5
refs/heads/master
2023-07-06T13:13:35.749373
2023-07-05T20:37:20
2023-07-05T20:37:20
40,010,175
80
40
null
2023-03-12T19:35:51
2015-07-31T14:51:56
C
UTF-8
C
false
false
297
h
#ifndef USBRTC_H #define USBRTC_H #include <stdbool.h> #include <inttypes.h> typedef struct { } usb_usbrtc_info_t; // interface to usb core extern const usb_device_class_config_t usb_usbrtc_class; uint8_t usb_rtc_get_time(uint8_t *d); uint8_t usb_rtc_set_time(uint8_t *d); #endif // USBRTC_H
3d8e10a0a11ae04836e7d1648c7b563edf8a39af
a471ea5984916770691d1e7c6aeb7e44d20e073a
/vm/src/play_exec.c
d0626d16ee6b10326e11b49664f0c6f8afaaa1fc
[]
no_license
nerahmou/corewar
8a31ef456e8e994e574ff3b4c807083ba1094e06
88706426a5e8704000bd722a027ef10ba63fc34e
refs/heads/master
2020-03-28T03:49:43.499761
2018-10-18T14:13:19
2018-10-18T14:13:19
147,674,120
0
1
null
null
null
null
UTF-8
C
false
false
2,293
c
/* ************************************************************************** */ /* LE - / */ /* / */ /* play_exec.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: kevazoul <[email protected]> +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2018/04/17 19:44:03 by kevazoul #+# ## ## #+# */ /* Updated: 2018/09/02 12:27:42 by amatthys ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include "corewar.h" static void cor_attribute_instr(t_prog *prog, int8_t *mem) { if (!prog->instr.cmd && !cor_get_new_instr(mem, prog)) prog->pc = cor_pc(prog->pc + 1); } static void cor_decrement_left_cycles(t_prog *prog) { if (prog->instr.cmd && prog->instr.left_cycles) prog->instr.left_cycles--; } static void cor_exec_instr(t_session *session, t_prog *prog) { if (cor_get_args(&prog->instr, session->mem, prog)) { if (session->v & 0x04 && prog->instr.cmd->op_code != 0x10) cor_print_prog(prog); if (session->v & 0xf0 && (prog->instr.cmd->op_code != 0x09 || !prog->carry)) ft_printf("ADV %d (0x%.4x -> 0x%.4x)\n", prog->instr.size, prog->pc, cor_pc(prog->pc + prog->instr.size)); if (session->v & 0xf0 && prog->instr.cmd->op_code == 0x09 && prog->carry) { ft_printf("Jump from 0x%.4x to 0x%.4x\n", prog->pc, cor_pc(prog->pc + cor_get_int(session, prog, 0))); } prog->instr.cmd->f(session, prog); } prog->pc = cor_pc(prog->pc + prog->instr.size); prog->instr.cmd = NULL; } void cor_exec_cycle(t_session *session) { t_prog *prog; prog = session->progs; while (prog) { cor_attribute_instr(prog, session->mem); cor_decrement_left_cycles(prog); if (prog->instr.cmd && !prog->instr.left_cycles) cor_exec_instr(session, prog); prog = prog->next; } }
5aafe1e2300392132420f16aacc23b83168b6a81
607e69f9e4440ef3ab9c33b7b6e85e95b5e982fb
/deps/museum/5.0.0/bionic/libc/kernel/uapi/linux/can/netlink.h
ce33e4de42b42e67ec534451e1025c751243b1e5
[ "Apache-2.0" ]
permissive
simpleton/profilo
8bda2ebf057036a55efd4dea1564b1f114229d1a
91ef4ba1a8316bad2b3080210316dfef4761e180
refs/heads/master
2023-03-12T13:34:27.037783
2018-04-24T22:45:58
2018-04-24T22:45:58
125,419,173
0
0
Apache-2.0
2018-03-15T19:54:00
2018-03-15T19:54:00
null
UTF-8
C
false
false
3,777
h
/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef CAN_NETLINK_H #define CAN_NETLINK_H #define _CAN_NETLINK_H #define _CAN_NETLINK_H_ #define _UAPI_CAN_NETLINK_H #define _UAPI_CAN_NETLINK_H_ #define _UAPICAN_NETLINK_H #define _UAPICAN_NETLINK_H_ #define CAN_NETLINK_H_ #include <museum/5.0.0/bionic/libc/linux/types.h> struct can_bittiming { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 bitrate; __u32 sample_point; __u32 tq; __u32 prop_seg; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 phase_seg1; __u32 phase_seg2; __u32 sjw; __u32 brp; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct can_bittiming_const { char name[16]; __u32 tseg1_min; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 tseg1_max; __u32 tseg2_min; __u32 tseg2_max; __u32 sjw_max; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 brp_min; __u32 brp_max; __u32 brp_inc; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct can_clock { __u32 freq; }; enum can_state { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CAN_STATE_ERROR_ACTIVE = 0, CAN_STATE_ERROR_WARNING, CAN_STATE_ERROR_PASSIVE, CAN_STATE_BUS_OFF, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CAN_STATE_STOPPED, CAN_STATE_SLEEPING, CAN_STATE_MAX }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct can_berr_counter { __u16 txerr; __u16 rxerr; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct can_ctrlmode { __u32 mask; __u32 flags; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CAN_CTRLMODE_LOOPBACK 0x01 #define CAN_CTRLMODE_LISTENONLY 0x02 #define CAN_CTRLMODE_3_SAMPLES 0x04 #define CAN_CTRLMODE_ONE_SHOT 0x08 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CAN_CTRLMODE_BERR_REPORTING 0x10 struct can_device_stats { __u32 bus_error; __u32 error_warning; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 error_passive; __u32 bus_off; __u32 arbitration_lost; __u32 restarts; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; enum { IFLA_CAN_UNSPEC, IFLA_CAN_BITTIMING, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ IFLA_CAN_BITTIMING_CONST, IFLA_CAN_CLOCK, IFLA_CAN_STATE, IFLA_CAN_CTRLMODE, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ IFLA_CAN_RESTART_MS, IFLA_CAN_RESTART, IFLA_CAN_BERR_COUNTER, __IFLA_CAN_MAX /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) #endif
382b2b24b2feec551b4c4e4b75257354dc002e08
5f9b26a41102c38da28b8f757a5586f9bc7cf71a
/crates/zig_build_bin_windows_x86_64/zig-windows-x86_64-0.5.0+80ff549e2/lib/zig/libc/musl/src/ctype/iswlower.c
e00395441e67cdd190cb1a44eb678466cf545142
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-musl-exception", "MIT" ]
permissive
jeremyBanks/zig_with_cargo
f8e65f14adf17ed8d477f0856257422c2158c63f
f8ee46b891bbcdca7ff20f5cad64aa94c5a1d2d1
refs/heads/master
2021-02-06T10:26:17.614138
2020-03-09T04:46:26
2020-03-09T04:46:26
243,905,553
4
1
null
null
null
null
UTF-8
C
false
false
194
c
#include <wctype.h> int iswlower(wint_t wc) { return towupper(wc) != wc; } int __iswlower_l(wint_t c, locale_t l) { return iswlower(c); } weak_alias(__iswlower_l, iswlower_l);
4f65aa81e323987b65cd4e33b8eb2a7c62e8a144
fa643f39c5c0f1941d2419f69b69fb0c2ed82581
/pixel_core/generic/shaders.h
7ad9e7a87b9fc571902e20afc8bba4083f8a283f
[]
no_license
cyanogilvie/pixel
4e69818a452806458d7b1996284d610f4c901666
21f62fc85565cb9d12a342013690ab22ea4fb139
refs/heads/master
2023-03-07T10:35:52.679352
2023-02-20T12:30:30
2023-02-20T12:30:30
116,158,087
4
0
null
null
null
null
UTF-8
C
false
false
268
h
#ifndef _SHADERS_H #define _SHADERS_H #ifndef EXTERN_C # ifdef __cplusplus # define EXTERN_C extern "C" # else # define EXTERN_C extern # endif #endif EXTERN_C void quadshade(double x, double y, _pel colour, int osa, int flags, gimp_image_t *dest); #endif
[ "root" ]
root
86012e68bc75f2bcdd754a82adf8d8858eef77c8
52e653ced65249ebcb70f7df8b6398c7a1b55125
/corewar/libft/ft_strsplit.c
badcffe4e95d3cd539af506cd34c183e940067b6
[]
no_license
tdautreme/My_projects_at_42
4ba679c7d5908d2153a8584c65677a81c8cdfafd
01550fe622cfd1f183e944e37e6c4275f4201f13
refs/heads/master
2021-06-27T15:33:42.656992
2020-12-09T13:37:48
2020-12-09T13:37:48
191,175,217
0
0
null
null
null
null
UTF-8
C
false
false
2,222
c
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_strsplit.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: pduhard- <[email protected]> +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2019/01/15 04:07:41 by pduhard- #+# ## ## #+# */ /* Updated: 2019/01/15 05:39:32 by pduhard- ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include "libft.h" static int len_max(char const *s, char c) { int nb; int i; nb = 0; i = 0; if (s) { while (s[i]) { while (s[i] && s[i] == c) i++; if (s[i] && s[i] != c) nb++; while (s[i] && s[i] != c) i++; if (s[i]) i++; } } return (nb); } static int cut(char const *s, char c, int i) { int nb; nb = 0; if (s) { while (s[i] && s[i] != c) { nb++; i++; } } return (nb); } static int check(char const *s, char c, int i) { if (s) { while (s[i] && s[i] == c) i++; } return (i); } static char **test(char const *s, char **str, char c, int i) { int y; int x; y = 0; while (s[i]) { x = 0; i = check(s, c, i); if (!(str[y] = (char*)malloc(sizeof(char) * (cut(s, c, i) + 1)))) return (NULL); while (s[i] != c && s[i]) str[y][x++] = s[i++]; i = check(s, c, i); str[y][x] = '\0'; y++; } str[y] = 0; return (str); } char **ft_strsplit(char const *s, char c) { char **str; int i; i = 0; i = check(s, c, i); if (!(str = (char**)malloc(sizeof(char*) * (len_max(s, c) + 1)))) return (NULL); if (s) str = test(s, str, c, i); return (str); }
a494d06bf963daa8c4e1a4d72a5469da81158247
3844678a0fb3b1f0838fb04bc57fd93dee6ee631
/siteApps/PVAccessGW/v4workspace/pvData/testApp/rtemsTestHarness.c
b6ef3ba6cf35253e57d279172fdba119b492b850
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
jeonghanlee/Work
daa9295da3af3ff6c3a68daf51fac804dd1942cd
bef817911ea29fe091547f001ac35ac3765d8258
refs/heads/master
2022-09-28T03:59:29.435017
2022-09-15T18:26:34
2022-09-15T18:26:34
91,843,357
3
0
null
2019-01-08T16:10:37
2017-05-19T20:34:36
VHDL
UTF-8
C
false
false
845
c
#include <stdio.h> #include <stdlib.h> #include <rtems/rtems_bsdnet.h> #include <rtems/error.h> #include "rtemsNetworking.h" #include <epicsExit.h> #include <osdTime.h> rtems_task Init (rtems_task_argument ignored) { rtems_bsdnet_initialize_network (); //rtems_bsdnet_show_if_stats (); rtems_time_of_day timeOfDay; if (rtems_clock_get(RTEMS_CLOCK_GET_TOD,&timeOfDay) != RTEMS_SUCCESSFUL) { timeOfDay.year = 2014; timeOfDay.month = 1; timeOfDay.day = 1; timeOfDay.hour = 0; timeOfDay.minute = 0; timeOfDay.second = 0; timeOfDay.ticks = 0; rtems_status_code ret = rtems_clock_set(&timeOfDay); if (ret != RTEMS_SUCCESSFUL) { printf("**** Can't set time %s\n", rtems_status_text(ret)); } } osdTimeRegister(); extern void pvDataAllTests(void); pvDataAllTests(); epicsExit(0); }
67c2b6b51b05076e840211358d2a9563759a9711
e7be2ee48f952308f5672240c2c833d718d9d431
/Juliet_Test_Suite_v1.3_for_C_Cpp/C/testcases/CWE194_Unexpected_Sign_Extension/s01/CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04.c
bb6251f320f00e291a88800bdf5c3add60014641
[]
no_license
buihuynhduc/tooltest
5146c44cd1b7bc36b3b2912232ff8a881269f998
b3bb7a6436b3ab7170078860d6bcb7d386762b5e
refs/heads/master
2020-08-27T20:46:53.725182
2019-10-25T05:42:36
2019-10-25T05:42:36
217,485,049
1
0
null
null
null
null
UTF-8
C
false
false
7,019
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04.c Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml Template File: sources-sink-04.tmpl.c */ /* * @description * CWE: 194 Unexpected Sign Extension * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Positive integer * Sink: memcpy * BadSink : Copy strings using memcpy() with the length of data * Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE) * * */ #include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 /* Must be at least 8 for atoi() to work properly */ #define CHAR_ARRAY_SIZE 8 #define IP_ADDRESS "127.0.0.1" /* The two variables below are declared "const", so a tool should * be able to identify that reads of these will always return their * initialized values. */ static const int STATIC_CONST_TRUE = 1; /* true */ static const int STATIC_CONST_FALSE = 0; /* false */ #ifndef OMITBAD void CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04_bad() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_TRUE) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* FLAW: Use a value input from the network */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the STATIC_CONST_TRUE to STATIC_CONST_FALSE */ static void goodG2B1() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { short data; /* Initialize data */ data = 0; if(STATIC_CONST_TRUE) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } { char source[100]; char dest[100] = ""; memset(source, 'A', 100-1); source[100-1] = '\0'; if (data < 100) { /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative, * the sign extension could result in a very large number */ memcpy(dest, source, data); dest[data] = '\0'; /* NULL terminate */ } printLine(dest); } } void CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE194_Unexpected_Sign_Extension__connect_socket_memcpy_04_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
3690f81b0cf35589291acabdbac964fec794b798
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/9d64c8c8-bd2a-41f2-b87a-99999c5f07e9.c
3e13e89536ae082b8212d41ebcd69f0eb2342845
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
582
c
#include <string.h> #include <stdio.h> int main() { int i=0; int j=11; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = i/j; l = i%j; l = l%j; k = i-j*i; //variables //random /* START VULNERABILITY */ int a; long b[58]; long c[12]; a = 0; do { //random /* START BUFFER SET */ *((long *)c + a) = *((long *)b + a); /* END BUFFER SET */ a++; } while(b[a] != 0); /* END VULNERABILITY */ //random printf("%d%d\n",k,l); return 0; }
c3864a3f710469fd0cb406f72ed29ffea65fc6c3
0b9c033d21b30b1954d237f5802f87038e2f5004
/build/mplabx-pic18/blinktest_18f25k50_xc8.X/mcc_generated_files/device_config.c
e30b3c7eefe49a1f657b67e98c49a9255bff0a9a
[]
no_license
rsenn/pictest
76de5348ab1a4aacd44b9780bb94c7982bb2beba
7f485cc6b571f79d37d810bc7d3ea7ed709faf27
refs/heads/main
2023-07-16T01:04:09.996757
2023-07-07T07:36:42
2023-07-07T07:36:42
36,510,048
1
2
null
null
null
null
UTF-8
C
false
false
7,272
c
/** @Generated PIC10 / PIC12 / PIC16 / PIC18 MCUs Source File @Company: Microchip Technology Inc. @File Name: mcc.c @Summary: This is the device_config.c file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs @Description: This header file provides implementations for driver APIs for all modules selected in the GUI. Generation Information : Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.7 Device : PIC18F25K50 Driver Version : 2.00 The generated drivers are tested against the following: Compiler : XC8 2.31 and above or later MPLAB : MPLAB X 5.45 */ /* (c) 2018 Microchip Technology Inc. and its subsidiaries. Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. It is your responsibility to comply with third party license terms applicable to your use of third party software (including open source software) that may accompany Microchip software. THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. */ // Configuration bits: selected in the GUI // CONFIG1L #pragma config PLLSEL = PLL3X // PLL Selection->3x clock multiplier #pragma config CFGPLLEN = OFF // PLL Enable Configuration bit->PLL Disabled (firmware controlled) #pragma config CPUDIV = NOCLKDIV // CPU System Clock Postscaler->CPU uses system clock (no divide) #pragma config LS48MHZ = \ SYS48X8 // Low Speed USB mode with 48 MHz system clock->System clock at 48 MHz, USB clock divider is set to 8 // CONFIG1H #pragma config FOSC = INTOSCIO // Oscillator Selection->Internal oscillator #pragma config PCLKEN = ON // Primary Oscillator Shutdown->Primary oscillator enabled #pragma config FCMEN = OFF // Fail-Safe Clock Monitor->Fail-Safe Clock Monitor disabled #pragma config IESO = OFF // Internal/External Oscillator Switchover->Oscillator Switchover mode disabled // CONFIG2L #pragma config nPWRTEN = OFF // Power-up Timer Enable->Power up timer disabled #pragma config BOREN = SBORDIS // Brown-out Reset Enable->BOR enabled in hardware (SBOREN is ignored) #pragma config BORV = 190 // Brown-out Reset Voltage->BOR set to 1.9V nominal #pragma config nLPBOR = OFF // Low-Power Brown-out Reset->Low-Power Brown-out Reset disabled // CONFIG2H #pragma config WDTEN = SWON // Watchdog Timer Enable bits->WDT controlled by firmware (SWDTEN enabled) #pragma config WDTPS = 32768 // Watchdog Timer Postscaler->1:32768 // CONFIG3H #pragma config CCP2MX = RC1 // CCP2 MUX bit->CCP2 input/output is multiplexed with RC1 #pragma config PBADEN = OFF // PORTB A/D Enable bit->PORTB<5:0> pins are configured as digital I/O on Reset #pragma config T3CMX = RC0 // Timer3 Clock Input MUX bit->T3CKI function is on RC0 #pragma config SDOMX = RB3 // SDO Output MUX bit->SDO function is on RB3 #pragma config MCLRE = OFF // Master Clear Reset Pin Enable->RE3 input pin enabled; external MCLR disabled // CONFIG4L #pragma config STVREN = ON // Stack Full/Underflow Reset->Stack full/underflow will cause Reset #pragma config LVP = OFF // Single-Supply ICSP Enable bit->Single-Supply ICSP disabled #pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming Port Enable->ICPORT disabled #pragma config XINST = \ OFF // Extended Instruction Set Enable bit->Instruction set extension and Indexed Addressing mode disabled #pragma config DEBUG = \ ON // Background Debugger Enable bit->Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug // CONFIG5L #pragma config CP0 = OFF // Block 0 Code Protect->Block 0 is not code-protected #pragma config CP1 = OFF // Block 1 Code Protect->Block 1 is not code-protected #pragma config CP2 = OFF // Block 2 Code Protect->Block 2 is not code-protected #pragma config CP3 = OFF // Block 3 Code Protect->Block 3 is not code-protected // CONFIG5H #pragma config CPB = OFF // Boot Block Code Protect->Boot block is not code-protected #pragma config CPD = OFF // Data EEPROM Code Protect->Data EEPROM is not code-protected // CONFIG6L #pragma config WRT0 = OFF // Block 0 Write Protect->Block 0 (0800-1FFFh) is not write-protected #pragma config WRT1 = OFF // Block 1 Write Protect->Block 1 (2000-3FFFh) is not write-protected #pragma config WRT2 = OFF // Block 2 Write Protect->Block 2 (04000-5FFFh) is not write-protected #pragma config WRT3 = OFF // Block 3 Write Protect->Block 3 (06000-7FFFh) is not write-protected // CONFIG6H #pragma config WRTC = \ OFF // Configuration Registers Write Protect->Configuration registers (300000-3000FFh) are not write-protected #pragma config WRTB = OFF // Boot Block Write Protect->Boot block (0000-7FFh) is not write-protected #pragma config WRTD = OFF // Data EEPROM Write Protect->Data EEPROM is not write-protected // CONFIG7L #pragma config EBTR0 = \ OFF // Block 0 Table Read Protect->Block 0 is not protected from table reads executed in other blocks #pragma config EBTR1 = \ OFF // Block 1 Table Read Protect->Block 1 is not protected from table reads executed in other blocks #pragma config EBTR2 = \ OFF // Block 2 Table Read Protect->Block 2 is not protected from table reads executed in other blocks #pragma config EBTR3 = \ OFF // Block 3 Table Read Protect->Block 3 is not protected from table reads executed in other blocks // CONFIG7H #pragma config EBTRB = \ OFF // Boot Block Table Read Protect->Boot block is not protected from table reads executed in other blocks
f707ba701096a35e931a3ab53f53d8d6243b2384
4aadc809ab5a32db077eb6e94308d4c304f7765f
/example/c/ARM/MSP/Click_RMS_to_DC_MSP.c
54b2498b61bed0ad1a57eab8cd4b917f59dcdeb3
[]
no_license
MikroElektronika/RMS_to_DC_click
678daa373c10fcdcf98ce20475c8902a296fbc52
8d8be31a086a5475e24494d409f8a9bc95b11731
refs/heads/master
2020-04-27T17:54:21.852651
2019-03-08T13:36:14
2019-03-08T13:36:14
174,543,404
0
0
null
null
null
null
UTF-8
C
false
false
2,492
c
/* Example for RMS_to_DC Click Date : Nov 2018. Author : Nemanja Medakovic Test configuration MSP : MCU : MSP432 Dev. Board : Clicker 2 for MSP432 ARM Compiler ver : v6.0.0.0 --- Description : The application is composed of three sections : - System Initialization - Initializes peripherals and pins. - Application Initialization - Initializes I2C interface and turns ON the device. - Application Task - (code snippet) - Reads averaged DC output voltage calculated to mV and sends results to the serial plotter. Note : The input voltage frequency should be in the range from 50Hz to 250kHz. Also the input voltage amplitude must be lower than 5V. In this conditions the device can convert the RMS signal, in every form, to DC signal. Additional Functions : - void plotData( T_RMS2DC_V plotY ) - Sends data (DC voltage) to the serial plotter. - void logData() - Sends DC voltage value to the uart terminal. */ #include "Click_RMS_to_DC_types.h" #include "Click_RMS_to_DC_config.h" T_RMS2DC_V outVoltDC; uint32_t plotX; char text[ 30 ]; void plotData( T_RMS2DC_V plotY ) { WordToStr( plotY, text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( ",", _LOG_TEXT ); LongWordToStr( plotX, text ); mikrobus_logWrite( text, _LOG_LINE ); if (plotX == 0xFFFFFFFF) { plotX = 0; } else { plotX++; } } void logData() { WordToStr( outVoltDC, text ); mikrobus_logWrite( "DC voltage : ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " mV", _LOG_LINE ); } void systemInit() { mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_CS_PIN, _GPIO_OUTPUT ); mikrobus_i2cInit( _MIKROBUS1, &_RMS2DC_I2C_CFG[0] ); mikrobus_logInit( _MIKROBUS2, 9600 ); mikrobus_logWrite( "*** Initializing... ***", _LOG_LINE ); Delay_ms( 100 ); } void applicationInit() { rms2dc_i2cDriverInit( (T_RMS2DC_P)&_MIKROBUS1_GPIO, (T_RMS2DC_P)&_MIKROBUS1_I2C, _RMS2DC_DEVICE_ADDR ); Delay_ms( 500 ); rms2dc_enable( _RMS2DC_DEVICE_EN ); plotX = 0; mikrobus_logWrite( "** RMS to DC is initialized **", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); } void applicationTask() { outVoltDC = rms2dc_avrgVoutADC( _RMS2DC_VCC_3V3, 25 ); plotData( outVoltDC ); Delay_ms( 5 ); } void main() { systemInit(); applicationInit(); while (1) { applicationTask(); } }
333fb793ea83c5f0e6655adda1048830dfa33d7b
f481776fb7b91377e73932196938f274001d276c
/src/demo/wolfssl-3.15.3/include/wolfssl/wolfcrypt/wolfevent.h
f4b0b979f2208d5890fbcedee28856511b896783
[ "Apache-2.0" ]
permissive
xupenghu/ML302
88c1d70b559b9cd2306fdfb261f00398c03035a8
e9c4f30bfe22bb0c14d9393c58053b230a354079
refs/heads/master
2022-04-28T04:10:56.424852
2020-04-28T02:36:13
2020-04-28T02:36:13
259,520,292
2
3
Apache-2.0
2020-04-28T03:22:40
2020-04-28T03:22:39
null
UTF-8
C
false
false
3,839
h
/* wolfevent.h * * Copyright (C) 2006-2017 wolfSSL Inc. * * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * wolfSSL 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ #ifndef _WOLF_EVENT_H_ #define _WOLF_EVENT_H_ #ifdef __cplusplus extern "C" { #endif #ifndef SINGLE_THREADED #include <wolfssl/wolfcrypt/wc_port.h> #endif #ifndef WOLFSSL_WOLFSSL_TYPE_DEFINED #define WOLFSSL_WOLFSSL_TYPE_DEFINED typedef struct WOLFSSL WOLFSSL; #endif typedef struct WOLF_EVENT WOLF_EVENT; #ifndef WOLFSSL_WOLFSSL_CTX_TYPE_DEFINED #define WOLFSSL_WOLFSSL_CTX_TYPE_DEFINED typedef struct WOLFSSL_CTX WOLFSSL_CTX; #endif typedef unsigned short WOLF_EVENT_FLAG; typedef enum WOLF_EVENT_TYPE { WOLF_EVENT_TYPE_NONE, #ifdef WOLFSSL_ASYNC_CRYPT WOLF_EVENT_TYPE_ASYNC_WOLFSSL, /* context is WOLFSSL* */ WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT, /* context is WC_ASYNC_DEV */ WOLF_EVENT_TYPE_ASYNC_FIRST = WOLF_EVENT_TYPE_ASYNC_WOLFSSL, WOLF_EVENT_TYPE_ASYNC_LAST = WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT, #endif /* WOLFSSL_ASYNC_CRYPT */ } WOLF_EVENT_TYPE; typedef enum WOLF_EVENT_STATE { WOLF_EVENT_STATE_READY, WOLF_EVENT_STATE_PENDING, WOLF_EVENT_STATE_DONE, } WOLF_EVENT_STATE; struct WOLF_EVENT { /* double linked list */ WOLF_EVENT* next; WOLF_EVENT* prev; void* context; union { void* ptr; #ifdef WOLFSSL_ASYNC_CRYPT struct WC_ASYNC_DEV* async; #endif } dev; #ifdef HAVE_CAVIUM word64 reqId; #ifdef WOLFSSL_NITROX_DEBUG word32 pendCount; #endif #endif #ifndef WC_NO_ASYNC_THREADING pthread_t threadId; #endif int ret; /* Async return code */ unsigned int flags; WOLF_EVENT_TYPE type; WOLF_EVENT_STATE state; }; enum WOLF_POLL_FLAGS { WOLF_POLL_FLAG_CHECK_HW = 0x01, }; typedef struct { WOLF_EVENT* head; /* head of queue */ WOLF_EVENT* tail; /* tail of queue */ #ifndef SINGLE_THREADED wolfSSL_Mutex lock; /* queue lock */ #endif int count; } WOLF_EVENT_QUEUE; #ifdef HAVE_WOLF_EVENT /* Event */ WOLFSSL_API int wolfEvent_Init(WOLF_EVENT* event, WOLF_EVENT_TYPE type, void* context); WOLFSSL_API int wolfEvent_Poll(WOLF_EVENT* event, WOLF_EVENT_FLAG flags); /* Event Queue */ WOLFSSL_API int wolfEventQueue_Init(WOLF_EVENT_QUEUE* queue); WOLFSSL_API int wolfEventQueue_Push(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); WOLFSSL_API int wolfEventQueue_Pop(WOLF_EVENT_QUEUE* queue, WOLF_EVENT** event); WOLFSSL_API int wolfEventQueue_Poll(WOLF_EVENT_QUEUE* queue, void* context_filter, WOLF_EVENT** events, int maxEvents, WOLF_EVENT_FLAG flags, int* eventCount); WOLFSSL_API int wolfEventQueue_Count(WOLF_EVENT_QUEUE* queue); WOLFSSL_API void wolfEventQueue_Free(WOLF_EVENT_QUEUE* queue); /* the queue mutex must be locked prior to calling these */ WOLFSSL_API int wolfEventQueue_Add(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); WOLFSSL_API int wolfEventQueue_Remove(WOLF_EVENT_QUEUE* queue, WOLF_EVENT* event); #endif /* HAVE_WOLF_EVENT */ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* _WOLF_EVENT_H_ */
0ef860439197d829836cedfc79da155cb7b6c364
9f1205c3f1ef76c810e8ce187fd232515e8a702b
/ft_itoa_base/ft_itoa_base.c
2a1aaca162ff0912b4adfcd24187a8047677773a
[]
no_license
AnaChepurna/Alone_In_The_Dark_Beginer
7d1073741c1c51fdaa128d698a158224e51f9af0
1cf73217d1650caac2883622455a6e7942bb6e71
refs/heads/master
2021-08-26T03:42:16.384775
2017-11-21T13:55:12
2017-11-21T13:55:12
108,643,787
0
0
null
null
null
null
UTF-8
C
false
false
1,680
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa_base.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: exam <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/14 12:15:59 by exam #+# #+# */ /* Updated: 2017/11/14 12:54:34 by exam ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> int bufflen(unsigned int n, int base) { int i; if (n == 0) return (2); i = 1; while (n > 0) { i++; n = n / base; } return (i); } char *fill_str(unsigned int n, int base, int sign) { int len; char *res; char *map; map = "0123456789ABCDEF"; len = bufflen(n, base) + sign; if ((res = (char *)malloc(sizeof(char) * len))) { if (sign) res[0] = '-'; res[--len] = '\0'; while (--len - sign >= 0) { res[len] = map[n % base]; n = n / base; } } return (res); } char *ft_itoa_base(int value, int base) { char *res; int sign; unsigned int n; if (base < 2 || base > 16) return (NULL); sign = 0; if (base == 10 && value < 0) sign = 1; n = value > 0 ? value : -value; res = fill_str(n, base, sign); return (res); }
c5057839a13f206c880c358b713ec9ab57ca3564
f377472e1ddcb6f2e5dc42b520d0482260c43588
/libft/src/tmp/ft_strclr.c
283613d46236b70351cec7b5f88cad6de91753ef
[]
no_license
4bosch/push_swap
41cba79d784accee8684dbd350818f8fd926f2fe
dd55ff592872af16dfab3055c701089b033e9509
refs/heads/master
2022-12-06T09:20:09.335963
2020-05-08T10:45:53
2020-05-08T10:45:53
null
0
0
null
null
null
null
UTF-8
C
false
false
982
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strclr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: abosch <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/09 16:26:51 by abosch #+# #+# */ /* Updated: 2018/11/10 12:33:15 by abosch ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft/tmp.h" void ft_strclr(char *s) { if (s) ft_memset(s, 0, ft_strlen(s)); }
86926545f3cbcc080390376fdf7c4aebeb5233c1
aa58cf1d0e152f3c4ce43fce7dcbb29d7fe748ab
/0x15-file_io/0-read_textfile.c
0de25b7a433a011cf8d3cced507c20deaaeb1a43
[]
no_license
I7RANK/holbertonschool-low_level_programming
aa53754de643248634860fc3d8d0bbb75f5be771
1b9cafc34c95c8e404b37fb3f54f1cad2ef64969
refs/heads/master
2023-02-16T05:29:33.504370
2021-01-15T19:40:26
2021-01-15T19:40:26
271,358,046
0
0
null
null
null
null
UTF-8
C
false
false
740
c
#include "holberton.h" /** * read_textfile - reads and writes a file * @filename: it's the name of the file * @letters: is the number of letters it should read and print * * Return: the number of letters reads and prints */ ssize_t read_textfile(const char *filename, size_t letters) { int fd = 0, cant_rd = 0, cant_wr = 0; char *fd_read = NULL; if (filename == NULL) return (0); fd_read = malloc(sizeof(char) * letters); if (fd_read == NULL) return (0); fd = open(filename, O_RDONLY); if (fd < 0) return (0); cant_rd = read(fd, fd_read, letters); if (cant_rd < 0) return (0); cant_wr = write(STDOUT_FILENO, fd_read, cant_rd); if (cant_wr < 0) return (0); close(fd); free(fd_read); return (cant_wr); }
e5b4e2b346c03f43c74a69f24323c4fe3e32e8a7
014ca6018b254f00776f538834623ebc10b8ca23
/libsrc/src/dconvert/pace/pacedmp.h
07450f0d7697381cd45663fd755e5ca12222d54b
[]
no_license
IMAGE-ET/dicom3tools
5aacebf2bc661b5afab83a0ac53b08cf5319bc87
a8c0a8e6b4a3767ba1a4edfb6471fd584406dcde
refs/heads/master
2020-03-11T18:44:08.741659
2017-02-18T21:49:02
2017-02-18T21:49:02
null
0
0
null
null
null
null
UTF-8
C
false
false
146
h
/* pacedmp.h Copyright (c) 1993-2015, David A. Clunie DBA PixelMed Publishing. All rights reserved. */ #include "pacecl.h" #include "txstream.h"
122383b38d7034f1f41621ba2a96cef1d60ae9f5
9a51fdc162230544c2cf2471d518688ba99d8ed9
/include/libg.h
dbeaeb044d7e3095a3734e6a598d463c4499a64c
[ "dtoa" ]
permissive
8l/sam2
bbdca7f8d1fa5fbd83e5f7a494e395ee22e73191
36d1b635905551a9fbae6ab7f175e7f25740bd43
refs/heads/master
2021-01-16T21:59:57.353001
2016-09-10T21:47:45
2016-09-10T21:47:45
67,904,484
6
1
null
null
null
null
UTF-8
C
false
false
6,354
h
/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */ #ifndef _LIBG_H #define _LIBG_H /* * Like Plan9's libg.h, but suitable for inclusion on non-Plan9 machines */ #include <X11/Xft/Xft.h> enum{ EMAXMSG = 128+8192 }; /* max event size */ /* * Cursors */ enum{ DefaultCursor, BullseyeCursor, SweepCursor, DeadCursor, LockCursor }; /* * Types */ typedef struct Bitmap Bitmap; typedef struct Point Point; typedef struct Rectangle Rectangle; typedef struct Keystroke Keystroke; typedef struct Mouse Mouse; typedef struct Menu Menu; typedef struct Event Event; typedef struct RGB RGB; struct Point { int x; int y; }; struct Rectangle { Point min; Point max; }; struct Bitmap { Rectangle r; /* rectangle in data area, local coords */ Rectangle clipr; /* clipping region */ int ldepth; int id; /* as known by the X server */ Bitmap *cache; /* zero; distinguishes bitmap from layer */ XftDraw *fd; /* font drawable */ int flag; /* flag used by X implementation of libg */ }; struct Mouse { int buttons; /* bit array: LMR=124 */ Point xy; unsigned long msec; }; struct Keystroke { int k; int c; int t; Point p; }; struct Menu { char **item; char *(*gen)(int); int lasthit; }; struct Event { Keystroke keystroke; Mouse mouse; int n; /* number of characters in mesage */ unsigned char data[EMAXMSG]; /* message from an arbitrary file descriptor */ }; struct RGB { unsigned long red; unsigned long green; unsigned long blue; }; enum{ Knone, /* invalid command type */ Kdefault, /* perform default command action */ Kraw, /* insert raw character code, subject to transformation (e.g. tab expansion) */ Kcomposed, /* insert composed character code */ Kcommand, /* execute command (see below) */ Kend /* mark the end of a command list */ }; enum{ Cnone, /* no command */ Cdefault, /* default action */ Csysmax }; enum{ Tcurrent, /* command is sent to focused layer */ Tmouse /* command is sent to layer containing the mouse */ }; /* * Codes for bitblt etc. * * D * 0 1 * --------- * 0 | 1 | 2 | * S |---|---| * 1 | 4 | 8 | * --------- * * Usually used as D|S; DorS is so tracebacks are readable. */ typedef enum Fcode { Zero = 0x0, DnorS = 0x1, DandnotS = 0x2, notS = 0x3, notDandS = 0x4, notD = 0x5, DxorS = 0x6, DnandS = 0x7, DandS = 0x8, DxnorS = 0x9, D = 0xA, DornotS = 0xB, S = 0xC, notDorS = 0xD, DorS = 0xE, F = 0xF } Fcode; /* * Miscellany */ typedef void (*Errfunc)(char *); extern void addlatin(char, char, short); extern Point add(Point, Point); extern Point sub(Point, Point); extern Point mul(Point, int); extern Point divpt(Point, int); extern Rectangle rsubp(Rectangle, Point); extern Rectangle raddp(Rectangle, Point); extern Rectangle inset(Rectangle, int); extern Rectangle rmul(Rectangle, int); extern Rectangle rdiv(Rectangle, int); extern Rectangle rshift(Rectangle, int); extern Rectangle rcanon(Rectangle); extern Bitmap* balloc(Rectangle, int); extern void bfree(Bitmap*); extern int rectclip(Rectangle*, Rectangle); extern void xtbinit(Errfunc, char*, int*, char**, char**); extern void bclose(void); extern void berror(char*); extern void bitblt2(Bitmap*, Point, Bitmap*, Rectangle, Fcode, unsigned long, unsigned long); extern void bitblt(Bitmap*, Point, Bitmap*, Rectangle, Fcode); extern Point string(Bitmap*, Point, XftFont*, char*, Fcode); extern long strwidth(XftFont*, char*); extern Point strsize(XftFont*, char*); extern long charwidth(XftFont*, Rune); extern void texture(Bitmap*, Rectangle, Bitmap*, Fcode); extern void wrbitmap(Bitmap*, int, int, unsigned char*); extern void rdbitmap(Bitmap*, int, int, unsigned char*); extern void wrbitmapfile(int, Bitmap*); extern Bitmap* rdbitmapfile(int); extern int ptinrect(Point, Rectangle); extern int rectXrect(Rectangle, Rectangle); extern int eqpt(Point, Point); extern int eqrect(Rectangle, Rectangle); extern void border(Bitmap*, Rectangle, int, Fcode, unsigned long); extern void cursorswitch(unsigned int); extern void cursorset(Point); extern Rectangle bscreenrect(Rectangle*); extern void bflush(void); extern int clipr(Bitmap*, Rectangle); extern int scrpix(int*,int*); extern unsigned long getbg(void); extern void einit(unsigned long); extern unsigned long estart(unsigned long, int, int); extern unsigned long event(Event*); extern unsigned long eread(unsigned long, Event*); extern Mouse emouse(void); extern Keystroke ekbd(void); extern void pushkbd(int c); extern int ecanread(unsigned long); extern int ecanmouse(void); extern int ecankbd(void); extern void ereshaped(Rectangle); /* supplied by user */ extern int menuhit(int, Mouse*, Menu*); extern Rectangle getrect(int, Mouse*); extern void rdcolmap(Bitmap*, RGB*); extern void wrcolmap(Bitmap*, RGB*); extern void raisewindow(void); /* Extra functions supplied by libXg */ extern int snarfswap(char*, int, char**); extern int scrollfwdbut(void); enum{ Emouse = 1, Ekeyboard = 2 }; extern Point Pt(int, int); extern Rectangle Rect(int, int, int, int); extern Rectangle Rpt(Point, Point); #define Dx(r) ((r).max.x-(r).min.x) #define Dy(r) ((r).max.y-(r).min.y) extern Bitmap screen; extern XftFont *font; extern XftColor fontcolor; extern XftColor bgcolor; #define BGSHORT(p) (((p)[0]<<0) | ((p)[1]<<8)) #define BGLONG(p) ((BGSHORT(p)<<0) | (BGSHORT(p+2)<<16)) #define BPSHORT(p, v) ((p)[0]=(v), (p)[1]=((v)>>8)) #define BPLONG(p, v) (BPSHORT(p, (v)), BPSHORT(p+2, (v)>>16)) extern int installbinding(int, KeySym, int, int); extern int installchord(int, int, int, int); extern int removebinding(int, KeySym); extern int removechord(int, int); extern char foregroundspec[1024]; extern char backgroundspec[1024]; extern char borderspec[1024]; extern char fontspec[1024]; #endif
dde368d989b05ca2e2ae9b91a05142172343f8dc
646a20dca2fd37523c10a50173f6587cd4683418
/test_multifd.c
cac479a539fa05444ba26593894247855b3dce9d
[]
no_license
martinho23/GNL
64083e70aafbe0c98db91641d244d533996a203d
3da5d0ca55cfb9be2c94140002e1723664055ec7
refs/heads/master
2021-05-12T18:45:45.858550
2018-03-28T08:57:01
2018-03-28T08:57:01
117,072,110
0
0
null
null
null
null
UTF-8
C
false
false
2,396
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test_multifd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jfarinha <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/03/26 21:05:36 by jfarinha #+# #+# */ /* Updated: 2018/03/26 21:24:09 by jfarinha ### ########.fr */ /* */ /* ************************************************************************** */ #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include "get_next_line.h" int main(void) { int fd1; int fd2; int fd3; int rv1; int rv2; int rv3; char *line1; char *line2; char *line3; fd1 = open("test.txt", O_RDONLY); fd2 = open("test2.txt", O_RDONLY); fd3 = open("test3.txt", O_RDONLY); line1 = NULL; line2 = NULL; line3 = NULL; rv1 = get_next_line(fd1, &line1); printf("L1 Code: %d |%s|\n", rv1, line1); free(line1); rv2 = get_next_line(fd2, &line2); printf("L2 Code: %d |%s|\n", rv2, line2); free(line2); rv3 = get_next_line(fd3, &line3); printf("L3 Code: %d |%s|\n", rv3, line3); free(line3); rv1 = get_next_line(fd1, &line1); printf("L1 Code: %d |%s|\n", rv1, line1); free(line1); rv2 = get_next_line(fd2, &line2); printf("L2 Code: %d |%s|\n", rv2, line2); free(line2); rv3 = get_next_line(fd3, &line3); printf("L3 Code: %d |%s|\n", rv3, line3); free(line3); rv1 = get_next_line(fd1, &line1); printf("L1 Code: %d |%s|\n", rv1, line1); free(line1); rv2 = get_next_line(fd2, &line2); printf("L2 Code: %d |%s|\n", rv2, line2); free(line2); rv3 = get_next_line(fd3, &line3); printf("L3 Code: %d |%s|\n", rv3, line3); free(line3); rv1 = get_next_line(fd1, &line1); printf("L1 Code: %d |%s|\n", rv1, line1); free(line1); rv2 = get_next_line(fd2, &line2); printf("L2 Code: %d |%s|\n", rv2, line2); free(line2); rv3 = get_next_line(fd3, &line3); printf("L3 Code: %d |%s|\n", rv3, line3); free(line3); return (0); }
bb3e65341fde51cad47d20824ce8fad2194909b9
55671cffe6b226af766075e6f6a845d310a7f17f
/puzzles/MS_Projects/string_scratch/string_scratch/ReverseWords.c
cdc43cdeadf167490db99e2fdb16fe11a3e304d7
[]
no_license
njagdale/code-magic
506b4135b3cff58ec58e750c1acfb83e145f83e0
e5c3822b5232f65def4d5095c51fac3f4b011952
refs/heads/master
2021-01-21T13:34:59.531534
2016-05-09T22:42:31
2016-05-09T22:42:31
43,973,596
0
1
null
null
null
null
WINDOWS-1258
C
false
false
1,731
c
/* Reverse Words Write a function that reverses the order of the words in a string. For example, your function should transform the string “Do or do not, there is no try.” to “try. no is there not, do or Do”. Assume that all words are space delimited and treat punctuation the same as letters.**/ /* Algorithm: its easier to do swap of characters in the string ... replace every character in the string from start to end Then for every word from the beginning of the string, reverse the characters in the word eg: string reversal lasrever gnirts reversal string **/ #include <stdio.h> #include <string.h> void revereString(char* str, int start, int end) { char temp; int len = strlen(str); // start = 0; // end = strlen(str) - 1; while(end > start) { temp = str[start]; str[start] = str[end]; str[end] = temp; start++; end--; } str[len] = '\0'; } int main() { char str[] = "string reversal"; char space = ' '; int startWord = 0; int endWord = 0; int len = strlen(str); int i = 0; //int curr = 0; printf("\nOriginal String: %s", str); revereString(str, 0, (strlen(str)-1)); // find each word till end of string is reached while( str[startWord] ) { while(str[startWord] == space) startWord++; endWord = startWord; while(str[endWord] != space && str[endWord] != '\0') endWord++; endWord--; revereString(str, startWord, endWord); startWord = ++endWord; } printf("\nReversed String: %s", str); return 0; }
ba22c58807c6acd2b28c9bb1c0d841e8b574698b
f999679c21450e126d5764e15ba8656595546634
/H8mini_acro/src/defines.h
596e31a6c0df7b7e4ad895ad25558d599b0682a8
[]
no_license
rthille/h8mini-acro
cdc90de2e2ed44c873ca8dae02377e65a3d71410
629e0d9eba85f698311d2f7b98191d8ae9ef8f52
refs/heads/master
2020-12-30T19:44:41.382433
2015-12-29T22:05:12
2015-12-29T22:05:12
null
0
0
null
null
null
null
UTF-8
C
false
false
269
h
// defines for things that do not normally need changing #define MOTOR_FL 0 #define MOTOR_FR 3 #define MOTOR_BL 2 #define MOTOR_BR 1 #define PIDNUMBER 3 #define DEGTORAD 0.017453292 #define AUXNUMBER 6 #define ROLL 0 #define PITCH 1 #define YAW 2
56fcb7c38fa15ddb470e4393e2b489ef4249f3d7
c425afb8bb6b182168fd4c3a46c9b334f4740e60
/clone/lonely/mojian.c
0a5c6409b2c801edc8b3e5bd10773d6dcfb26a56
[]
no_license
fluffos/nt7
ceef82b2465cf322549c7ece6ce757eaa8ec31ff
52727f5a4266b14f1796c2aa297ca645ca07282a
refs/heads/main
2023-06-17T10:07:33.000534
2021-07-15T11:15:05
2021-07-15T11:15:05
308,148,401
9
9
null
2021-06-28T14:11:57
2020-10-28T21:45:40
C
UTF-8
C
false
false
1,886
c
#include <weapon.h> #include <ansi.h> inherit SWORD; void create() { set_name(NOR + WHT "墨剑" NOR, ({ "mo jian", "mo", "jian" }) ); set_weight(14000); if (clonep()) destruct(this_object()); else { set("long", WHT "一柄通体墨黑的长剑,剑身透着奇异的光泽。\n" NOR); set("unit", "柄"); set("value", 800000); set("no_sell", 1); set("material", "steel"); set("wield_msg", WHT "只见$N" WHT "单袖轻轻一抖,手中已多了一柄通" "体墨黑的长剑。\n" NOR); set("unwield_msg", WHT "$N" WHT "微微一笑,将手中的墨黑长剑插回腰" "间。\n" NOR); set("stable", 100); } init_sword(90); setup(); } mixed hit_ob(object me, object victim, int damage_bonus) { int n; if (me->query_skill_mapped("sword") != "shangqing-jian" || me->query_skill("shangqing-jian", 1) < 100) return damage_bonus / 2; switch (random(12)) { case 0: if (! victim->is_busy()) victim->start_busy(me->query_skill("sword") / 12 + 1); return WHT "$N" WHT "反转墨剑剑身,接连划出数朵剑花,顿时剑光四射,攻得$n" WHT "措手不及!\n" NOR; case 1: n = me->query_skill("sword"); victim->receive_damage("qi", n * 3 / 4, me); victim->receive_wound("qi", n * 3 / 4, me); return WHT "$N" WHT "一声冷哼,手中墨剑中宫直进,霎时一道剑气至墨剑剑尖电" "射而出,贯向$n" WHT "!\n" NOR; } return damage_bonus; }
9d33bd1be3c6fb2f6b32099e226d61a0e47ee75a
aa1a534bfb0434941b1dcc6033fc55b54b93d423
/asn1c/PDUSessionResourceReleaseResponse.c
62d863ee4cce28a7df3b32cc907ceab79a6b194e
[]
no_license
anishmu/ngapv2
7ea38dd39c1ee9290ca26a6fcb226c9dfb2e80e7
c6d826656e84485c8e651031a742d0feec17f2ed
refs/heads/master
2022-01-22T08:12:15.084364
2019-08-06T12:18:52
2019-08-06T12:18:52
null
0
0
null
null
null
null
UTF-8
C
false
false
1,995
c
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-PDU-Contents" * found in "../NGAP-PDU-Contents.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #include "PDUSessionResourceReleaseResponse.h" asn_TYPE_member_t asn_MBR_PDUSessionResourceReleaseResponse_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PDUSessionResourceReleaseResponse, protocolIEs), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_ProtocolIE_Container_127P3, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "protocolIEs" }, }; static const ber_tlv_tag_t asn_DEF_PDUSessionResourceReleaseResponse_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_PDUSessionResourceReleaseResponse_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */ }; asn_SEQUENCE_specifics_t asn_SPC_PDUSessionResourceReleaseResponse_specs_1 = { sizeof(struct PDUSessionResourceReleaseResponse), offsetof(struct PDUSessionResourceReleaseResponse, _asn_ctx), asn_MAP_PDUSessionResourceReleaseResponse_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_PDUSessionResourceReleaseResponse = { "PDUSessionResourceReleaseResponse", "PDUSessionResourceReleaseResponse", &asn_OP_SEQUENCE, asn_DEF_PDUSessionResourceReleaseResponse_tags_1, sizeof(asn_DEF_PDUSessionResourceReleaseResponse_tags_1) /sizeof(asn_DEF_PDUSessionResourceReleaseResponse_tags_1[0]), /* 1 */ asn_DEF_PDUSessionResourceReleaseResponse_tags_1, /* Same as above */ sizeof(asn_DEF_PDUSessionResourceReleaseResponse_tags_1) /sizeof(asn_DEF_PDUSessionResourceReleaseResponse_tags_1[0]), /* 1 */ { 0, 0, SEQUENCE_constraint }, asn_MBR_PDUSessionResourceReleaseResponse_1, 1, /* Elements count */ &asn_SPC_PDUSessionResourceReleaseResponse_specs_1 /* Additional specs */ };
a4f502de4c79d8525c90eb3a734e168eb19abe84
2875e427d9931ab8cfe2e066e1568c3130fcc3f2
/Solaris_2.6/os_net/src_ws/usr/src/cmd/adb/sparc/command_sparc.c
90bbdbd907c95d9ef076a0a97aead260a2fd5929
[]
no_license
legacy-codedigger/Solaris-2.6-Source-Code
3afaff70487fb96c864d55bd5845dd11c6c5c871
60a0b3093caa7d84e63dd891a23df0e8e720bf3d
refs/heads/master
2022-05-23T16:05:32.631954
2020-04-25T01:07:08
2020-04-25T01:07:08
258,658,903
1
1
null
null
null
null
UTF-8
C
false
false
3,755
c
/* * Copyright (c) 1995 by Sun Microsystems, Inc. */ /* * adb - SPARC extended command parser. */ #ident "@(#)command_sparc.c 1.4 96/06/18 SMI" #include "adb.h" #include <stdio.h> #include "fio.h" #include "fpascii.h" #define QUOTE 0200 #define STRIP 0177 extern int datalen; extern int wp_mask; const char *bphdr = "breakpoints\ncount%8tbkpt%24ttype%34tlen%40tcommand\n"; /* * This file contains archecture specific extensions to the command parser * The following must be defined in this file: * *----------------------------------------------------------------------- * ext_slash: * command extensions for /,?,*,= . * ON ENTRY: * cmd - is the char format (ie /v would yeld v) * buf - pointer to the raw command buffer * defcom - is the char of the default command (ie last command) * eqcom - true if command was = * atcom - true if command was @ * itype - address space type (see adb.h) * ptype - symbol space type (see adb.h) * ON EXIT: * Will return non-zero if a command was found. * *----------------------------------------------------------------------- * ext_getstruct: * return the address of the ecmd structure for extended commands (ie ::) * *----------------------------------------------------------------------- * ext_ecmd: * extended command parser (ie :: commands) * ON ENTRY: * buf - pointer to the extended command * ON EXIT: * Will exec a found command and return non-zero * *----------------------------------------------------------------------- * ext_dol: * command extensions for $ . * ON ENTRY: * modif - is the dollar command (ie $b would yeld b) * ON EXIT: * Will return non-zero if a command was found. * */ /* This is archecture specific extensions to the slash cmd. * On return this will return non-zero if there was a cmd! */ int ext_slash(cmd, buf, defcom, eqcom, atcom, itype, ptype) char cmd; char *buf, defcom; int eqcom, atcom, itype, ptype; { return (0); } /* breakpoints */ struct bkpt *bkpthead; /* This is archecture specific extensions to the $ cmd. * On return this will return non-zero if there was a cmd! */ int ext_dol(modif) int modif; { switch(modif) { #if defined(KADB) && defined(sun4u) case 'l': /* * Set watchpoint mask. */ wp_mask = (hadaddress ? address : 0xff); if (wp_mask > 0xff || wp_mask < 0) wp_mask = 0xff; break; #endif case 'b': { register struct bkpt *bkptr; printf(bphdr); for (bkptr = bkpthead; bkptr; bkptr = bkptr->nxtbkpt) if (bkptr->flag) { printf("%-8.8d", bkptr->count); psymoff(bkptr->loc, ISYM, "%24t"); switch (bkptr->type) { #if defined(KADB) case BPINST: printf(":b instr"); break; case BPACCESS: printf(":a v,r/w"); break; case BPWRITE: printf(":w v,w"); break; case BPPHYS: printf(":f p,r/w"); break; #else case BPINST: printf(":b instr"); break; case BPDBINS: printf(":p exec"); break; case BPACCESS: printf(":a rd/wr"); break; case BPWRITE: printf(":w write"); break; #endif } printf("%34t%-5D %s", bkptr->len, bkptr->comm); } } break; default: return (0); } return (1); } /* * Extended commands. */ static struct ecmd sparc_ecmd[]; /* * This returns the address of the ext_extended command structure. */ struct ecmd * ext_getstruct() { return (sparc_ecmd); } /* * Architecture-specific extensions to the extended cmds (::). */ int ext_ecmd(buf) char *buf; { int i; i = extend_scan(buf, sparc_ecmd); if (i >= 0) { (*sparc_ecmd[i].func)(); return (1); } return (0); } /* * all aval extended commands should go here */ static struct ecmd sparc_ecmd[] = { { 0 } };
7cf13c3fb9bdd9336082349095e461a59f6bd332
71f0bc221632ca165ab173ce58e59cda2095e9a3
/Lista 1 (Váriaveis e Expressões)/Exercicio_4.c
8385a9ed3a6cd5da56bfdf22eb0374f4fb6b6f78
[]
no_license
GuAntunes/excercises-language-C
696a3a40c7e98aba80e1d8ae68e49158cbb6c3d1
e76b70ee1965b8a3d773744a03633a8e1131ee38
refs/heads/master
2022-04-17T21:18:03.444720
2020-04-17T00:35:42
2020-04-17T00:35:42
256,359,742
0
0
null
null
null
null
ISO-8859-1
C
false
false
399
c
#include <stdio.h> #include <stdlib.h> #include <locale.h> #include <math.h> #include <string.h> /*4. Leia um n´umero real e imprima a quinta parte deste n´umero.*/ int main() { setlocale(LC_ALL,"portuguese"); float num; printf("Digite um número: "); scanf("%f",&num); printf("A quinta parte desse número é: %.1f",num/5); getch(); return 0; }
3ab13045a521658afd6a2c2c2f3af1985aa804af
9fc6c5e964ea959e01baf7274eb2c88f6794ab24
/SYN_palindrome_2019/lib/my/my_swap.c
de32dc631f9e26317e111ff8564c1ef9924be875
[]
no_license
Nellousan/SchoolProjects
4e2c9e1aeafdff98932cb3eadda551b8b13c0530
af75f6ecc2c70d01c0550b44c3db1303c2bbccae
refs/heads/master
2023-08-25T14:18:46.576161
2021-11-09T19:48:11
2021-11-09T19:48:11
426,351,448
0
0
null
null
null
null
UTF-8
C
false
false
170
c
/* ** EPITECH PROJECT, 2019 ** my_swap ** File description: ** swap two integers */ void my_swap(int *a, int *b) { int c = 0; c = *b; *b = *a; *a = c; }
f712c4e8841d2f568191fb087498a6697408695b
b35d281d360ae0f178287cb395c08a29609fef82
/TivaWare/cc3100-sdk/netapps/http/client/urlhandler.h
e5bfdaad138fba64cf411b74ad9c1750c1e8847b
[]
no_license
jishminor/ee445l-linux
b6b55acad8cbf30d8def5a426b26ed396c4eeaf2
f85b4781d1130d24e5290da2ae7e0e9becee0f95
refs/heads/master
2021-05-11T07:41:55.017526
2019-01-30T01:10:36
2019-01-30T01:10:36
118,026,694
11
10
null
2019-01-30T01:10:37
2018-01-18T19:16:41
C
UTF-8
C
false
false
2,740
h
/* * Copyright (c) 2014, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _URLHANDLER_H_ #define _URLHANDLER_H_ #include <stddef.h> #include "ssock.h" #define URLHandler_GET 1 #define URLHandler_POST 2 #define URLHandler_PUT 3 #define URLHandler_DELETE 4 #define URLHandler_ENOTHANDLED 0 #define URLHandler_EHANDLED 1 #define URLHandler_EERRORHANDLED 2 typedef struct URLHandler_Object * URLHandler_Handle; typedef URLHandler_Handle (*URLHandler_CreateFxn)(void * arg); typedef int (*URLHandler_ProcessFxn)(URLHandler_Handle u, int method, const char * url, const char * urlArgs, int contentLength, Ssock_Handle s); typedef void (*URLHandler_ScanFieldFxn)(URLHandler_Handle u, int method, const char * url, const char * field); typedef void (*URLHandler_DeleteFxn)(URLHandler_Handle * u); typedef struct URLHandler_Setup { void * params; URLHandler_CreateFxn create; URLHandler_DeleteFxn delete; URLHandler_ProcessFxn process; URLHandler_ScanFieldFxn scan; } URLHandler_Setup; #endif
d737490844fe41cc84dfb92b1094b9957b057f0a
826c5c99332b1792f2f560edda7abddc41561e85
/core/lib/aztec/src/generate_mode_message.h
e01a7c8eb5b1c415932ba38851e8ab30b1efb9e6
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mcyril/barcodes
7064156751dc40afbc73d9aa6d7f48cdfe8d125e
523570475149fcc9f2153ed5b11812de2a622224
refs/heads/master
2021-01-17T00:01:06.938986
2018-11-07T12:44:13
2018-11-07T12:44:13
38,630,569
3
0
null
null
null
null
UTF-8
C
false
false
179
h
#pragma once #include "common_definitions.h" void generate_mode_message(bit_vector_type *mode_message, const symbol_info_type &symbol_info, unsigned short codewords_count);
[ "none@none" ]
none@none
7c71d2ed353966f9fe8f3cf7165b74349f7f676e
42851ca56d166903491e2122b2ffb9cc8804310b
/Projects/STM32F769I_EVAL/Examples/RTC/RTC_InternalTimeStamp/Inc/main.h
de88a54251d8c69a3fd5912c6f1a7faf43d85420
[]
no_license
SSSnow/STM32Cube_FW_F7_V1.5.0
d1495e5cdfb4716460e284cc1d830586a3926402
3d7a72da5deda5f01adb769d86cc5febd3a3e3f9
refs/heads/master
2021-01-23T02:15:18.139576
2016-12-08T16:59:42
2016-12-08T16:59:42
85,972,444
1
0
null
2017-03-23T16:30:21
2017-03-23T16:30:21
null
UTF-8
C
false
false
3,045
h
/** ****************************************************************************** * @file RTC/RTC_InternalTimeStamp/Inc/main.h * @author MCD Application Team * @version V1.2.0 * @date 23-September-2016 * @brief Header for main.c module ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f7xx_hal.h" #include "stm32f769i_eval.h" #include "stm32f769i_eval_lcd.h" #include <stdio.h> /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Defines related to Clock configuration */ #define RTC_ASYNCH_PREDIV 0x7F /* LSE as RTC clock */ #define RTC_SYNCH_PREDIV 0x00FF /* LSE as RTC clock */ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void Error_Handler(void); #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
e99477628cbf6481a5874088be17557336b7b186
2438042d46af5bdb72409f1ac74fd7a50efd7a52
/assets/Programs/All/Area of Circle.c
1f04316026079a17ae9e472adab86813080114b2
[]
no_license
Shahryar-Naseri/C-Programming-Android-App
6e5a7abedea1d92e5afcee624884379ae140c04c
d93e926a459b62d82d7bc584470192b1658cca5f
refs/heads/master
2021-01-01T05:37:33.846667
2014-11-27T16:24:30
2014-11-27T16:24:30
25,791,730
0
1
null
null
null
null
UTF-8
C
false
false
275
c
/* Program to calculate Area of Circle */ #include<stdio.h> #include<conio.h> int main() { float radius, area; printf("Enter the radius of Circle: "); scanf("%f", &radius); area = 3.14 * radius * radius; printf("\nArea of Circle: %f", area); getch(); }
b221a0b833ae56e9520fcce580538e7d86dc3c84
974389431527e451ce83049b11cd3dc42780108d
/phase_1/eval/channing/variants/unpatched/src/http.c
d369b3c1e7145749a64a34442be131ee4dff332a
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
cromulencellc/chess-aces
21d8e70c8d9853a922ca0c90ffdd2c79ba390fb0
8ea5b0d75ddbf45fd74a7b8c5ca03fc4955eba8b
refs/heads/main
2023-05-24T01:13:07.917910
2022-11-02T00:56:52
2022-11-02T00:56:52
351,277,450
7
2
null
null
null
null
UTF-8
C
false
false
6,890
c
#define _XOPEN_SOURCE #include "base64.h" #include "bst.h" #include "crc.h" #include "debug.h" #include "dictionary.h" #include "http.h" #include "http_errors.h" #include "url_decode.h" #include <crypt.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <libgen.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <time.h> #include <unistd.h> extern dictionaryType *mimeDict; extern bstType *ua_stats; int readLine(int fd, char *buffer, int maxLen); int handleRequest(serverConfigType *config, int in, int out) { char method[10]; char query[MAX_QUERY]; char uri[MAX_URI]; char version[10]; dictionaryType *headers = 0; char buffer[HTTP_BUFFER_SIZE]; int ret; int readIndex = 0; int writeIndex; enum state readState; int methodToken = 0; readState = METHOD; readIndex = 0; writeIndex = 0; while (1) { readMore: debug("at readmore\n"); ret = readLine(in, buffer, HTTP_BUFFER_SIZE - 1); if (ret == -1) { debug("Line too long!\n"); debug("%s\n", buffer); sendError(out, 414); return 0; } if (ret == 0) { debug("out of data from socket\n"); return 0; } debug("%d chars ready in this line\n", ret); debug("Line: %s\n", buffer); readIndex = 0; switch (readState) { case METHOD: debug("At Method\n"); while (buffer[readIndex] >= 'A' && buffer[readIndex] <= 'Z') { method[writeIndex] = buffer[readIndex]; ++writeIndex; ++readIndex; if (readIndex == ret) goto readMore; if (writeIndex >= 6) { debug("Bad method length\n"); sendError(out, 405); return 0; } } method[writeIndex] = 0; debug("Method = %s\n", method); if (strcmp(method, "GET") == 0) { methodToken = METHOD_GET; } else if (strcmp(method, "PUT") == 0) { methodToken = METHOD_PUT; } else if (strcmp(method, "POST") == 0) { methodToken = METHOD_POST; } else if (strcmp(method, "HEAD") == 0) { methodToken = METHOD_HEAD; } else { debug("Bad Method %s received\n", method); sendError(out, 405); return 0; } writeIndex = 0; readState = URI; case URI: debug("At URI\n"); while (isblank(buffer[readIndex])) { ++readIndex; if (readIndex == ret) goto readMore; } while (isgraph(buffer[readIndex]) && buffer[readIndex] != '?') { uri[writeIndex] = buffer[readIndex]; ++writeIndex; ++readIndex; if (readIndex == ret) goto readMore; if (writeIndex >= MAX_URI - 1) { debug("Bad URI length\n"); sendError(out, 414); return 0; } } if (buffer[readIndex] == '\r' || buffer[readIndex] == '\n') { debug("Bad request\n"); sendError(out, 405); return 0; } uri[writeIndex] = 0; debug("URI: %s\n", uri); readState = QUERY; writeIndex = 0; debug("len of URI = %lu\n", strlen(uri)); case QUERY: debug("At Query\n"); if (buffer[readIndex] != '?') { readState = VERSION; goto version; } else { debug("Getting a query string\n"); } ++readIndex; if (readIndex == ret) goto readMore; while (isgraph(buffer[readIndex])) { debug("Adding char: %c to query string\n", buffer[readIndex]); query[writeIndex] = buffer[readIndex]; if (readIndex == ret) { debug("going back to read more for query string\n"); goto readMore; } ++writeIndex; ++readIndex; if (writeIndex == MAX_QUERY - 1) { debug("Bad Query length\n"); return 0; } } debug("End of line for query string\n"); query[writeIndex] = 0; if (strlen(query)) { debug("Received a query string\n"); } readState = VERSION; writeIndex = 0; version: case VERSION: debug("At Version\n"); while (isspace(buffer[readIndex])) { ++readIndex; if (readIndex == ret) goto readMore; } while (isgraph(buffer[readIndex])) { if (writeIndex >= 9) { debug("Bad Version length\n"); sendError(out, 505); return 0; } version[writeIndex] = buffer[readIndex]; ++writeIndex; ++readIndex; if (readIndex == ret) { debug("going back to read more\n"); goto readMore; } } debug("End of line for vesion\n"); version[writeIndex] = 0; debug("Version: %s\n", version); while (buffer[readIndex] != '\n' && readIndex < ret) ++readIndex; debug("Found the end of the request line\n"); break; default: break; } break; } int count; count = readLine(in, buffer, HTTP_BUFFER_SIZE); if (count == -1) { debug("Got error response from readLine()\n"); return -1; } if (count == 0) { debug("No more data to read\n"); return 0; } while (strncmp(buffer, "\r\n", 2) != 0 && strncmp(buffer, "\n", 1) != 0) { addDictbyLine(&headers, buffer, ':'); count = readLine(in, buffer, HTTP_BUFFER_SIZE); if (count == -1) { debug("Got error response from readLine2()\n"); return -1; } else if (count == 0) { debug("No more data to read\n"); return 0; } debug("Read another line %s\n", buffer); } debug("No more lines in the header\n"); fprintf(stderr, "%s %s %s\n", method, uri, version); char *useragent_string = 0; useragent_string = findDict(headers, "User-Agent"); if (useragent_string) { unsigned long crc = crc32(0L, (unsigned char *)useragent_string, strlen(useragent_string)); debug("useragent hash: %lu\n", crc); if (!findBstNode(ua_stats, crc)) { char *ua_string = 0; ua_string = malloc(strlen(useragent_string) + 1); if (ua_string) { ua_string[0] = 0; memcpy(ua_string, useragent_string, strlen(useragent_string) + 1); addBstNode(&ua_stats, crc, ua_string); } else { debug("unable to allocate memory for useragent string\n"); return -1; } } else { incBstNode(&ua_stats, crc); } } switch (methodToken) { case METHOD_GET: serveFile(out, config, uri, headers); break; case METHOD_PUT: sendError(out, 501); break; case METHOD_POST: handlePost(in, out, config, uri, headers, version); break; case METHOD_HEAD: headFile(out, config, uri, headers); break; case METHOD_DELETE: sendError(out, 501); break; default: sendError(out, 501); break; } deleteDict(&headers); if (headers != NULL) { debug("headers should be null\n"); } return 0; }
09cac5c3a79528d065282acc00466470f1e7604d
83a73ae20e36c3259b24da5a08750dc34e299d9d
/FreqCountBD_wrapper/ps7_cortexa9_0/domain_ps7_cortexa9_0/bsp/ps7_cortexa9_0/include/xil_util.h
cdfba4135203debca7f940748b4c28af13bb1b26
[ "MIT" ]
permissive
renorega/workspace
96819bd51903eddb87978bc0934f7495321cb8b0
a655702e48c26d3278f8f42954adb1d133a64e9e
refs/heads/main
2022-12-28T03:53:42.454415
2020-10-10T14:29:23
2020-10-10T14:29:23
303,057,410
0
0
MIT
2020-10-11T06:30:49
2020-10-11T06:30:48
null
UTF-8
C
false
false
2,830
h
/******************************************************************************/ /** * Copyright (c) 2019 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /****************************************************************************/ /** * @file xil_util.h * * This file contains xil utility functions declaration * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- -------- -------- ----------------------------------------------- * 6.4 mmd 04/21/19 First release. * 6.5 kal 02/29/20 Added Xil_ConvertStringToHexBE API * </pre> * *****************************************************************************/ #ifndef XIL_UTIL_H_ #define XIL_UTIL_H_ #ifdef __cplusplus extern "C" { #endif #include "xil_types.h" #include "xil_io.h" #include "xstatus.h" /*************************** Constant Definitions *****************************/ #define XIL_SIZE_OF_NIBBLE_IN_BITS 4U #define XIL_SIZE_OF_BYTE_IN_BITS 8U /* Maximum string length handled by Xil_ValidateHexStr function */ #define XIL_MAX_HEX_STR_LEN 512U /****************** Macros (Inline Functions) Definitions *********************/ /******************************************************************************/ /** * This API ceils the provided float value. * * @param Value is a float variable which has to ceiled to nearest * integer. * * @return Returns ceiled value. * * @note one. * *******************************************************************************/ #define Xil_Ceil(Value) \ (((Value > (u32)Value) || ((u32)Value == 0U)) ? \ (u32)((u32)Value + 1U) : (u32)Value) /*************************** Function Prototypes ******************************/ /* Converts input character to nibble */ u32 Xil_ConvertCharToNibble(u8 InChar, u8 *Num); /* Convert input hex string to array of 32-bits integers */ u32 Xil_ConvertStringToHex(const char *Str, u32 *buf, u8 Len); /* Waits for specified event */ u32 Xil_WaitForEvent(u32 RegAddr, u32 EventMask, u32 Event, u32 Timeout); /* Waits for specified events */ u32 Xil_WaitForEvents(u32 EventsRegAddr, u32 EventsMask, u32 WaitEvents, u32 Timeout, u32* Events); /* Validate input hex character */ u32 Xil_IsValidHexChar(const char Ch); /* Validate the input string contains only hexadecimal characters */ u32 Xil_ValidateHexStr(const char *HexStr); /* Convert string to hex numbers in little enidian format */ u32 Xil_ConvertStringToHexLE(const char *Str, u8 *Buf, u32 Len); /* Returns length of the input string */ u32 Xil_Strnlen(const char *Str, u32 MaxLen); /* Convert string to hex numbers in big endian format */ u32 Xil_ConvertStringToHexBE(const char * Str, u8 * Buf, u32 Len); #ifdef __cplusplus } #endif #endif /* XIL_UTIL_H_ */
5662c88036bb7a42b5ba63ddc57fe7682ffd35fd
5c255f911786e984286b1f7a4e6091a68419d049
/vulnerable_code/19a0acd3-40f4-4107-8d3b-e1a5b707d179.c
3af11e65bc77d655ce3e3d93ba8a376974c353e0
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944740
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
544
c
#include <string.h> #include <stdio.h> int main() { float i; float j; float k; float l; i = 6; k = 9; //variables //random /* START VULNERABILITY */ int a; int b[62]; int c[44]; a = 0; while (a < strlen(b)) { //random /* START BUFFER SET */ *((int *)c + a) = *((int *)b + a); /* END BUFFER SET */ a++; } /* END VULNERABILITY */ k = 3; l = l*j*k/9; printf("vulnerabbbvity"); printf("%f\n",l); return 0; }
79480e9691cdcbbac31ecf13ffa27087cf20085b
f1855df95a97f7b75ffa9bfcc18fd137142821ba
/Chapter-4/Exercise 4-3/buffer.c
3835c6ec40b528040f0a3a68a370a27734e8f236
[]
no_license
ajaysharma388/the-c-programming-language-second-edition-solutions
8b91d3ffd39477ee890353b567798828b246e455
3d78d880c4792bb58f053747d7114a4fe54fd540
refs/heads/master
2020-09-01T20:07:35.080847
2018-11-05T18:04:32
2018-11-05T18:04:32
null
0
0
null
null
null
null
UTF-8
C
false
false
425
c
#include <stdio.h> #define BUFSIZE 100 char buf[BUFSIZE]; /* buffer for ungetch */ int bufp = 0; /* buffer pointer (not a real pointer) */ int getch(void) /* get a (possibly pushed back) character */ { return (bufp > 0) ? buf[--bufp] : getchar(); } void ungetch(int c) /* push character back on input */ { if (bufp >= BUFSIZE) printf("ungetch : too many characters\n"); else buf[bufp++] = c; }
3ad5021c3924c16424aab1caffedfd6a1644f69d
423c388d66a91ae24490ee1a3565fa8af3a9673b
/coloring.c
c94ad2b8b1aa9ffdadef9516b6913d328bda1c34
[]
no_license
Teybeo/fractal
e81d80ac7236589983ceea3e885fa904b2004c4b
b794c88c272b32691dae18499db6da12f4d6af0b
refs/heads/master
2020-04-13T16:30:23.636668
2019-09-13T10:22:14
2019-09-13T10:22:14
163,322,374
0
0
null
null
null
null
UTF-8
C
false
false
2,707
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* coloring.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tdarchiv <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/23 20:25:28 by tdarchiv #+# #+# */ /* Updated: 2019/02/28 14:16:09 by tdarchiv ### ########.fr */ /* */ /* ************************************************************************** */ #include "coloring.h" #include "gradient.h" #include <math.h> uint32_t depth_to_color(uint16_t depth, int depth_max, uint32_t *palette) { uint32_t color; float normalized; int color_index; normalized = (depth / (float)depth_max); normalized = sinf(((float)M_PI * normalized) * 0.5f); color_index = (int)(normalized * (PALETTE_COLOR_COUNT - 1)); color_index *= 2; color_index %= PALETTE_COLOR_COUNT; color = palette[color_index] * (depth != 0); return (color); } void draw_color_region(t_config cfg, t_frame frame, t_rect rect) { uint16_t depth; int x; int y; int i; if (rect.size.x == 0 || rect.size.y == 0) return ; y = (int)rect.origin.y; while (y < (rect.origin.y + rect.size.y)) { x = (int)rect.origin.x; while (x < (rect.origin.x + rect.size.x)) { i = (int)(y * frame.size.x + x); depth = frame.iter[i]; frame.pixels[i] = depth_to_color(depth, cfg.depth_max, cfg.palette); x++; } y++; } } void draw_color(t_config cfg, t_frame frame) { uint32_t color; int i; int x; int y; y = -1; while (++y < frame.size.y) { x = -1; i = (y * (int)(frame.size.x)); while (++x < frame.size.x) { color = depth_to_color(frame.iter[i], cfg.depth_max, cfg.palette); if (cfg.show_chunks) color |= ((y / cfg.lines_per_chunk) % 2) * 0x22000000u; if (cfg.show_palette) color = cfg.palette[(int)((x / frame.size.x) * PALETTE_COLOR_COUNT)]; frame.pixels[i] = color; i++; } } } void set_palette(uint32_t *palette, int gradient_type) { int i; float percent; t_gradient gradient; gradient = create_gradient(gradient_type); i = 0; while (i < PALETTE_COLOR_COUNT) { percent = (float)i / PALETTE_COLOR_COUNT; palette[i] = get_color_from_gradient(gradient, percent); i++; } destroy_gradient(gradient); }
e079ec9791c6459f50c126dd838664688de1e5bd
a92b18defb50c5d1118a11bc364f17b148312028
/src/prod/src/retail/native/fabricgatewayresourcemanager/dll/stdafx.h
172f48daa1cb895718b5287ac71f975c5c261e99
[ "MIT" ]
permissive
KDSBest/service-fabric
34694e150fde662286e25f048fb763c97606382e
fe61c45b15a30fb089ad891c68c893b3a976e404
refs/heads/master
2023-01-28T23:19:25.040275
2020-11-30T11:11:58
2020-11-30T11:11:58
301,365,601
1
0
MIT
2020-11-30T11:11:59
2020-10-05T10:05:53
null
UTF-8
C
false
false
380
h
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once #include "Management/GatewayResourceManager/GatewayResourceManager.h"
5781d8d1fa37d8dcad3d50dc12998aa13fde33ee
d624428a859029dce15a705ec6d58b021f550459
/MQProxy/HLRagent/agentoam/src/common/inc/taskcommon.h
a84b807e4a97cb434329804ead2d4474206fac0a
[]
no_license
ALiBaBa-Jimmy/MQProxy
2337ad8c93c57243216c3c681cc399b6588dfe3c
051b579ef5cb0b08bbf47616e2284581ce623e6e
refs/heads/master
2021-08-30T20:30:27.707060
2017-12-19T09:10:28
2017-12-19T09:10:28
114,743,130
0
0
null
null
null
null
GB18030
C
false
false
839
h
#pragma once #ifdef __cplusplus extern "C" { #endif #include "xostype.h" #include "xosshell.h" #pragma pack(1) typedef struct _STaskContext { XU16 taskIndex; //task的索引 XU16 taskcount; //总的task个数 XU32 startFid; //此任务开始的fid 主要是为了不在任务内在关系FID的定义 XBOOL g_bBeAttached; XVOID* taskFidList; XU32 taskTid; XU32 taskFid; XU32 dbTaskId; XU32 messageCount;//当前处理的个数 }STaskContext; typedef struct _STaskContextAry { XU32 taskcount;//任务总共的线程数 XU32 endFid; XU32 startFid; XU32 dispatchFid; //当前负载的Fid值,使用与简单的负载,收到一个消息在这个任务所有的线程中依次发送 //每个线程的上下文信息 STaskContext *pTaskContext; }STaskContextAry; #pragma pack() #ifdef __cplusplus } #endif
d022365378693b8561de7f9ba30448605c4d7efb
d627a04349f03fa3c48956dc1e927aa056fc674b
/SDK/ToolChain/Host/HERMON/gcc-3.4.4-glibc-2.3.5-armv4/arm-linux/arm-linux/sys-include/linux/gfp.h
7851e6b520cf013f4091cd4932f69cb4b00e76b5
[]
no_license
devicenull/supermicro_ipmi_firmware
68be097cef9a3b8ec9ec58c323778f6fa123ac79
942d7ed17d177d5324bd6ccdd080b92fc7433517
refs/heads/master
2020-06-07T23:31:12.831652
2014-06-22T23:56:17
2014-06-22T23:56:17
20,347,147
57
22
null
null
null
null
UTF-8
C
false
false
5,802
h
#ifndef __LINUX_GFP_H #define __LINUX_GFP_H #include <linux/mmzone.h> #include <linux/stddef.h> #include <linux/linkage.h> #include <linux/config.h> struct vm_area_struct; /* * GFP bitmasks.. */ /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */ #define __GFP_DMA ((__force gfp_t)0x01u) #define __GFP_HIGHMEM ((__force gfp_t)0x02u) #ifdef CONFIG_DMA_IS_DMA32 #define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */ #elif BITS_PER_LONG < 64 #define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */ #else #define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */ #endif /* * Action modifiers - doesn't change the zoning * * __GFP_REPEAT: Try hard to allocate the memory, but the allocation attempt * _might_ fail. This depends upon the particular VM implementation. * * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller * cannot handle allocation failures. * * __GFP_NORETRY: The VM implementation must not retry indefinitely. */ #define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */ #define __GFP_HIGH ((__force gfp_t)0x20u) /* Should access emergency pools? */ #define __GFP_IO ((__force gfp_t)0x40u) /* Can start physical IO? */ #define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ #define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ #define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ #define __GFP_REPEAT ((__force gfp_t)0x400u) /* Retry the allocation. Might fail */ #define __GFP_NOFAIL ((__force gfp_t)0x800u) /* Retry for ever. Cannot fail */ #define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ #define __GFP_NO_GROW ((__force gfp_t)0x2000u)/* Slab internal usage */ #define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ #define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /* if you forget to add the bitmask here kernel will crash, period */ #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ __GFP_NOMEMALLOC|__GFP_HARDWALL) /* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ #define GFP_ATOMIC (__GFP_HIGH) #define GFP_NOIO (__GFP_WAIT) #define GFP_NOFS (__GFP_WAIT | __GFP_IO) #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS) #define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ __GFP_HIGHMEM) /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some platforms, used as appropriate on others */ #define GFP_DMA __GFP_DMA /* 4GB DMA on some platforms */ #define GFP_DMA32 __GFP_DMA32 static inline int gfp_zone(gfp_t gfp) { int zone = GFP_ZONEMASK & (__force int) gfp; BUG_ON(zone >= GFP_ZONETYPES); return zone; } /* * There is only one page-allocator function, and two main namespaces to * it. The alloc_page*() variants return 'struct page *' and as such * can allocate highmem pages, the *get*page*() variants return * virtual kernel addresses to the allocated page(s). */ /* * We get the zone list from the current node and the gfp_mask. * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. * * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets * optimized to &contig_page_data at compile-time. */ #ifndef HAVE_ARCH_FREE_PAGE static inline void arch_free_page(struct page *page, int order) { } #endif extern struct page * FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *)); static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { if (unlikely(order >= MAX_ORDER)) return NULL; /* Unknown node is current node */ if (nid < 0) nid = numa_node_id(); return __alloc_pages(gfp_mask, order, NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); } #ifdef CONFIG_NUMA extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); static inline struct page * alloc_pages(gfp_t gfp_mask, unsigned int order) { if (unlikely(order >= MAX_ORDER)) return NULL; return alloc_pages_current(gfp_mask, order); } extern struct page *alloc_page_vma(gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr); #else #define alloc_pages(gfp_mask, order) \ alloc_pages_node(numa_node_id(), gfp_mask, order) #define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0) #endif #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order)); extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask)); #define __get_free_page(gfp_mask) \ __get_free_pages((gfp_mask),0) #define __get_dma_pages(gfp_mask, order) \ __get_free_pages((gfp_mask) | GFP_DMA,(order)) extern void FASTCALL(__free_pages(struct page *page, unsigned int order)); extern void FASTCALL(free_pages(unsigned long addr, unsigned int order)); extern void FASTCALL(free_hot_page(struct page *page)); extern void FASTCALL(free_cold_page(struct page *page)); #define __free_page(page) __free_pages((page), 0) #define free_page(addr) free_pages((addr),0) void page_alloc_init(void); #ifdef CONFIG_NUMA void drain_node_pages(int node); #else static inline void drain_node_pages(int node) { }; #endif #endif /* __LINUX_GFP_H */
f71dfd8f331ecdfc8f04cc8ee9fc5862e9b9fb7a
d2bdc0e99cbd21050418c3b93655fbe68d240077
/src/openblas/driver/level2/CMakeFiles/dtrmv_TLN.c
901fa1f621238e4340b611802c02953520141aba
[ "BSD-3-Clause" ]
permissive
fengbingchun/Caffe_Test
1cd48c852a44fb289dcf50603a3c5fe4451c7e4a
c21c1347cfa3cd20d03c74cc41170969324835bf
refs/heads/master
2021-07-15T13:29:24.758771
2021-03-03T03:21:52
2021-03-03T03:21:52
54,307,657
34
31
null
null
null
null
UTF-8
C
false
false
264
c
#define TRANSA #define ASMNAME _dtrmv_TLN #define ASMFNAME _dtrmv_TLN_ #define NAME dtrmv_TLN_ #define CNAME dtrmv_TLN #define CHAR_NAME "dtrmv_TLN_" #define CHAR_CNAME "dtrmv_TLN" #define DOUBLE #include "E:/GitCode/Caffe_Test/src/openblas/driver/level2/trmv_U.c"
980c14868bef05f9cdd3f6c315f3882df32f186f
ee73fdcceb1094108c0a9e209535d7915e2e33b3
/Green openETCS Non-Vital Demonstrator/Source Code/Source Code ETCS Onboard Unit System/Generated_Code/KCG_GreenField/Procedure_Train_Reversing_Proce.c
260fcf4e49bb02a9b184d4090354f3c4932f2b4d
[]
no_license
stefan-karg/srcAndBinary
d912b03c44d75b807dc4f9b67938dde73dd52ccf
5e0a11c72a20ca8c1386c55d0cd3e4c7463fb600
refs/heads/master
2020-12-31T03:36:26.071772
2015-12-07T14:57:47
2015-12-07T15:00:53
47,557,434
0
0
null
2015-12-07T14:36:45
2015-12-07T14:36:45
null
UTF-8
C
false
false
5,322
c
/* $**************** KCG Version 6.4 (build i21) **************** ** Command: kcg64.exe -config R:/Repositories/modeling/model/Scade/System/OBU_PreIntegrations/openETCS_EVC/KCG_GreenField/config.txt ** Generation date: 2015-12-07T14:50:20 *************************************************************$ */ #include "kcg_consts.h" #include "kcg_sensors.h" #include "Procedure_Train_Reversing_Proce.h" #ifndef KCG_USER_DEFINED_INIT void Procedure_Train_Reversing_init_(outC_Procedure_Train_Reversing_ *outC) { outC->Condition_59 = kcg_true; outC->Ack_RV_Req_To_Driver = kcg_true; outC->init = kcg_true; outC->SM_Train_Reversing_state_nxt = SSM_st_Reversing_Procedure_Off_; } #endif /* KCG_USER_DEFINED_INIT */ #ifndef KCG_NO_EXTERN_CALL_TO_RESET void Procedure_Train_Reversing_reset(outC_Procedure_Train_Reversing_ *outC) { outC->init = kcg_true; } #endif /* KCG_NO_EXTERN_CALL_TO_RESET */ /* Procedures::Procedure_Train_Reversing */ void Procedure_Train_Reversing_Proce( /* Procedures::Procedure_Train_Reversing::Driver_Ack_RV */ kcg_bool Driver_Ack_RV, /* Procedures::Procedure_Train_Reversing::Train_Standstill */ kcg_bool Train_Standstill, /* Procedures::Procedure_Train_Reversing::Train_Position */ trainPosition_T_TrainPosition_T *Train_Position, /* Procedures::Procedure_Train_Reversing::Current_Mode */ T_Mode_Level_And_Mode_Types_Pkg Current_Mode, /* Procedures::Procedure_Train_Reversing::Reversing_Data */ T_Reversing_Data_Level_And_Mode *Reversing_Data, outC_Procedure_Train_Reversing_ *outC) { /* Procedures::Procedure_Train_Reversing::SM_Train_Reversing */ static SSM_ST_SM_Train_Reversing SM_Train_Reversing_state_sel; /* Procedures::Procedure_Train_Reversing::SM_Train_Reversing */ static SSM_ST_SM_Train_Reversing SM_Train_Reversing_state_act; /* Procedures::Procedure_Train_Reversing::Loc_Max_Safe_Front_In_RV_Area */ static kcg_bool Loc_Max_Safe_Front_In_RV_Area; /* Procedures::Procedure_Train_Reversing::Loc_RV_Data_Available */ static kcg_bool Loc_RV_Data_Available; /* Procedures::Procedure_Train_Reversing::Loc_Cond_Procedure_On */ static kcg_bool Loc_Cond_Procedure_On; /* init_SM_Train_Reversing */ if (outC->init) { outC->init = kcg_false; SM_Train_Reversing_state_sel = SSM_st_Reversing_Procedure_Off_; } else { SM_Train_Reversing_state_sel = outC->SM_Train_Reversing_state_nxt; } /* 1 */ Reversing_Calculations_Librairi( Reversing_Data, Train_Position, &Loc_Max_Safe_Front_In_RV_Area, &Loc_RV_Data_Available); Loc_Cond_Procedure_On = ((Current_Mode == FS_Level_And_Mode_Types_Pkg) | (Current_Mode == LS_Level_And_Mode_Types_Pkg) | (Current_Mode == OS_Level_And_Mode_Types_Pkg)) & Loc_RV_Data_Available; /* sel_SM_Train_Reversing */ switch (SM_Train_Reversing_state_sel) { case SSM_st_Reversing_Procedure_Off_ : if (Loc_Cond_Procedure_On) { SM_Train_Reversing_state_act = SSM_st_Reversing_Data_Available; } else { SM_Train_Reversing_state_act = SSM_st_Reversing_Procedure_Off_; } break; case SSM_st_Reversing_Condition_SM_T : if (Driver_Ack_RV) { SM_Train_Reversing_state_act = SSM_st_RV_Mode_SM_Train_Reversi; } else if (Loc_Cond_Procedure_On) { if (Train_Standstill & Loc_Max_Safe_Front_In_RV_Area) { SM_Train_Reversing_state_act = SSM_st_Reversing_Condition_SM_T; } else { SM_Train_Reversing_state_act = SSM_st_Reversing_Data_Available; } } else { SM_Train_Reversing_state_act = SSM_st_Reversing_Procedure_Off_; } break; case SSM_st_RV_Mode_SM_Train_Reversi : SM_Train_Reversing_state_act = SSM_st_RV_Mode_SM_Train_Reversi; break; case SSM_st_Reversing_Data_Available : if (Train_Standstill & Loc_Max_Safe_Front_In_RV_Area) { SM_Train_Reversing_state_act = SSM_st_Reversing_Condition_SM_T; } else if (Loc_Cond_Procedure_On) { SM_Train_Reversing_state_act = SSM_st_Reversing_Data_Available; } else { SM_Train_Reversing_state_act = SSM_st_Reversing_Procedure_Off_; } break; } /* act_SM_Train_Reversing */ switch (SM_Train_Reversing_state_act) { case SSM_st_Reversing_Procedure_Off_ : outC->Ack_RV_Req_To_Driver = kcg_false; outC->Condition_59 = kcg_false; outC->SM_Train_Reversing_state_nxt = SSM_st_Reversing_Procedure_Off_; break; case SSM_st_Reversing_Condition_SM_T : outC->Ack_RV_Req_To_Driver = kcg_true; outC->Condition_59 = kcg_false; outC->SM_Train_Reversing_state_nxt = SSM_st_Reversing_Condition_SM_T; break; case SSM_st_RV_Mode_SM_Train_Reversi : outC->Ack_RV_Req_To_Driver = kcg_false; outC->Condition_59 = kcg_true; outC->SM_Train_Reversing_state_nxt = SSM_st_RV_Mode_SM_Train_Reversi; break; case SSM_st_Reversing_Data_Available : outC->Ack_RV_Req_To_Driver = kcg_false; outC->Condition_59 = kcg_false; outC->SM_Train_Reversing_state_nxt = SSM_st_Reversing_Data_Available; break; } } /* $**************** KCG Version 6.4 (build i21) **************** ** Procedure_Train_Reversing_Proce.c ** Generation date: 2015-12-07T14:50:20 *************************************************************$ */