void readColumn(const std::string &name, std::vector<T> &vals, size_t count, bool resize, ndsize_t offset = 0) { Hydra<std::vector<T>> hydra(vals); if (resize) { vals.resize(count); } else if (count > vals.size()) { throw OutOfBounds("Vector not big enough for requested data"); } DataType dtype = hydra.element_data_type(); backend()->readColumn(name, offset, count, dtype, hydra.data()); }
void readColumn(const std::string &name, std::vector<T> &vals, bool resize = false, ndsize_t offset = 0) { Hydra<std::vector<T>> hydra(vals); size_t count = vals.size(); if (resize) { ndsize_t n_rows = rows(); if (offset > n_rows) { throw OutOfBounds("offset > number of rows"); } // >= 0, as per the check above n_rows -= offset; count = check::fits_in_size_t(n_rows, "n > sizeof(size_t)"); } // OOB check done by called readColumn below return this->readColumn<T>(name, vals, count, resize, offset); }
int tx_yoohoo(void) { int rc; unsigned short capabilities; char *pwd; y_akas = 0; if (strlen(nodes.Spasswd)) pwd = xstrcpy(nodes.Spasswd); else pwd = NULL; capabilities = LOCALCAPS; if (localoptions & NOZMODEM) capabilities &= ~(ZED_ZAPPER|ZED_ZIPPER); if (localoptions & NOZEDZAP) capabilities &= ~ZED_ZAPPER; if (localoptions & NOHYDRA) capabilities &= ~DOES_HYDRA; if ((localoptions & NOFREQS) == 0) capabilities |= WZ_FREQ; else emsi_local_opts |= OPT_NRQ; fillhello(capabilities,pwd); iscaller=1; if ((rc = txyoohoo()) == 0) { rc = rxyoohoo(); checkhello(); capabilities = hello2.capabilities; if (capabilities & WZ_FREQ) session_flags |= SESSION_WAZOO; else session_flags &= ~SESSION_WAZOO; } if (y_akas == 0) { Syslog('+', "All akas busy, abort"); return FTNERR_SESSION_ERROR; } if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) { Syslog('+', "No common protocols"); return FTNERR_SESSION_ERROR; } if (rc) return FTNERR_YOOHOO; IsDoing("Outbound %s", ascfnode(remote->addr, 0x0f)); session_state = STATE_SECURE; session_flags |= SESSION_WAZOO; if (capabilities & DOES_HYDRA) return hydra(1); else if ((capabilities & ZED_ZAPPER) || (capabilities & ZED_ZIPPER)) { if (capabilities & ZED_ZAPPER) emsi_local_protos = PROT_ZAP; else emsi_local_protos = PROT_ZMO; return txwazoo(); } else if (capabilities & Y_DIETIFNA) return txdietifna(); WriteError("YooHoo internal error - no proto for 0x%04xh",capabilities); return FTNERR_YOOHOO; }
int rx_yoohoo(void) { int rc, protect = FALSE; unsigned short capabilities,localcaps; char *pwd = NULL; callstat *cst; pwd = NULL; y_akas = 0; localcaps = LOCALCAPS; if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER); if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER; if (localoptions & NOHYDRA) localcaps &= ~DOES_HYDRA; emsi_local_opts = 0; emsi_remote_opts = 0; iscaller = 0; if ((rc = rxyoohoo()) == 0) { Loaded = checkhello(); if (y_akas == 0) { Syslog('+', "All akas busy, abort"); return FTNERR_SESSION_ERROR; } capabilities = hello2.capabilities; if (capabilities & WZ_FREQ) session_flags |= SESSION_WAZOO; else session_flags &= ~SESSION_WAZOO; localcaps &= capabilities; if (localcaps & DOES_HYDRA) localcaps &= DOES_HYDRA; else if (localcaps & ZED_ZAPPER) localcaps &= ZED_ZAPPER; else if (localcaps & ZED_ZIPPER) localcaps &= ZED_ZIPPER; else if (localcaps & FTB_USER) localcaps &= FTB_USER; else if (localcaps & Y_DIETIFNA) localcaps &= Y_DIETIFNA; if ((localoptions & NOFREQS) == 0) localcaps |= WZ_FREQ; else emsi_local_opts |= OPT_NRQ; if (((nlent=getnlent(remote->addr))) && (nlent->pflag != NL_DUMMY)) { Syslog('+', "Remote is a listed system"); strncpy(history.location, nlent->location, 35); UserCity(mypid, nlent->sysop, nlent->location); } cst = getstatus(remote->addr); if (cst->trystat) laststat = cst->trystat; Syslog('s', "Last session status %d", laststat); if (nlent) rdoptions(Loaded); if (strlen(nodes.Spasswd)) { if ((strncasecmp((char*)hello2.my_password, nodes.Spasswd, strlen(nodes.Spasswd)) == 0) && (strlen((char*)hello2.my_password) == strlen(nodes.Spasswd))) { Syslog('+', "Password correct, protected mail session"); protect = TRUE; pwd = xstrcpy(nodes.Spasswd); } else { if (pwd) free(pwd); pwd = xstrcpy((char *)"BAD_PASS"); Syslog('?', "Remote password \"%s\", expected \"%s\"", (char*)hello2.my_password, nodes.Spasswd); localcaps = 0; } } else Syslog('s', "No YooHoo password check"); inbound_open(remote->addr, protect, FALSE); fillhello(localcaps,pwd); rc = txyoohoo(); if (pwd) free(pwd); } if ((rc == 0) && ((localcaps & LOCALCAPS) == 0)) { Syslog('+', "No common protocols or bad password"); return 0; } if (rc) return FTNERR_YOOHOO; IsDoing("Inbound %s", ascfnode(remote->addr, 0x0f)); if (protect) session_state = STATE_SECURE; else session_state = STATE_UNSECURE; session_flags |= SESSION_WAZOO; if (localcaps & DOES_HYDRA) return hydra(0); else if ((localcaps & ZED_ZAPPER) || (localcaps & ZED_ZIPPER)) { if (localcaps & ZED_ZAPPER) emsi_local_protos = PROT_ZAP; else emsi_local_protos = PROT_ZMO; return rxwazoo(); } else if (localcaps & Y_DIETIFNA) return rxdietifna(); WriteError("YooHoo internal error - no proto for 0x%04xh",localcaps); return FTNERR_YOOHOO; }